User Tools

Site Tools


lights_out

This is an old revision of the document!


Lights Out

!What to do

Right now the code works so that a single clicked square is turned on or off as you click it. In the actual game, when you click on a light, it changes not only the light you clicked on, but also the one above, below and the one on the right and the left. You need to modify the @@Puzzle@@ method @@clickOn@@ so it will work properly. To do this without run time errors, you need to check if the neighboring light exists (there is nothing below the bottom row or the right of the last column, for instance).

!What else?

#Once you have that working, change the constructor of the @@Puzzle@@ so it randomly chooses to turn on several lights. #There is a version where there are no borders, so when you click on one of the lights on the edge, it changes the lights on the other side (Hint: use mod % ) #change the dimensions. #count the moves #not all random situations form a solvable puzzle. Make you code teak the random starting position so that it is solvable. To do this make sure there are an even number of lights turned on in the three “quiet positions” described here #keep score based on the minimum necessary moves

lights_out.1553783139.txt.gz · Last modified: 2019/03/28 10:25 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki