

In the LightsOutPuzzle class, write a method scramble(self) which scrambles the puzzle by calling perform_move(self, row, col) with probability 1/2 on each location on the board. In the LightsOutPuzzle class, write a method perform_move(self, row, col) that toggles the light located at the given row and column, as well as the appropriate neighbors. Write a top-level function create_puzzle(rows, cols) that returns a new LightsOutPuzzle of the specified dimensions with all lights initialized to the off state. > b =, ] > p = LightsOutPuzzle(b) > p.get_board), ] > b =, ] > p = LightsOutPuzzle(b) > p.get_board(), ] 2. You additionally may wish to store the dimensions of the board as separate internal variables, though this is not required. Also write a method get_board(self) that returns this internal representation. In the LightsOutPuzzle class, write an initialization method _init_(self, board) that stores an input board of this form for future use. A natural representation for this puzzle is a two-dimensional list of Boolean values, where True corresponds to the on state and False corresponds to the off state. See the end of the section for more details.
LIGHTS OUT PUZZLE CODE
Once you have completed the problems in this section, you can test your code in an interactive setting using the provided GUI. In this section, you will investigate the behavior of Lights Out puzzles of various sizes by implementing a Light soutPuzzle class. If a light along the edge of the board is toggled, then fewer than four other lights will be affected, as the missing neighbors will be ignored. The goal of the puzzle is to turn all the lights off, with the caveat that whenever a light is toggled, its neighbors above, below, to the left, and to the right will be toggled as well.

Lights Out The Lights Out puzzle consists of an mxn grid of lights, each of which has two states: on and off.
