empty_space grid_length box_length full_grid_size grid_length grid_length class sudokugrid def __init__(selforiginalsetup) originalsetup is string of characters for the puzzle setupwith numbers and periods (for the blank spaces see self originalsetup originalsetup the state of the sudoku grid is represented by dictionary with (xykeys and values of the number (as stringat that space self grid { self resetgrid(set the grid state to its original setup self moves [tracks each move for the undo feature def resetgrid(self) """reset the state of the gridtracked by self gridto the state in self originalsetup "" for in range( grid_length ) for in range( grid_length ) self grid[(xy)empty_space assert len(self originalsetup=full_grid_size goes from to goes from to while full_grid_size for in range(grid_length) self grid[(xy)self originalsetup[ + + def makemove(selfcolumnrownumber) """place the number at the column ( letter from to iand row (an integer from to on the grid "" 'abcdefghifind(columnconvert this to an integer int(row check if the move is being made on "givennumber if self originalsetup[ grid_length !empty_space return false self grid[(xy)number place this number on the grid we need to store separate copy of the dictionary object self moves append(copy copy(self grid) return true def undo(self) """set the current grid state to the previous state in the project #