Button Game: Rules
  1. Create a board of 36 (6 x 6) cells (buttons). To start the game, initialize the value of each cell to be 0.
  2. Pick a pair of random numbers, x,y, each in the range of [1,6].
  3. Increment the value of cell Cx,y by 1.
    • If x-1 >= 1 then increment Cx-1,y by 1.
    • If x+1 <= 6 then increment Cx+1,y by 1.
    • If y-1 >= 1 then increment Cx,y-1 by 1.
    • If y+1 <= 6 then increment Cx,y+1 by 1.
  4. If the value of any cell exceeds a value of 3, then set its value to 0. That is, repeated incrementing of a cell progresses as follows 0,1,2,3,0,1,...
  5. Repeat steps 2 and 4 for as many times as you would like -- fewer times makes the game easy, and more makes it hard.
  6. To play the game, the user may click on any cell (button), Cx,y. Decrement that cell's value by 1.
    • If x-1 >= 1 then decrement Cx-1,y by 1.
    • If x+1 <= 6 then decrement Cx+1,y by 1.
    • If y-1 >= 1 then decrement Cx,y-1 by 1.
    • If y+1 <= 6 then decrement Cx,y+1 by 1.
  7. If the value of any cell falls below a value of 0, then set its value to 3. That is, repeated decrementing of a cell progresses as follows 3,2,1,0,3,2,...
  8. If all of the cell's values are 0, then the game is over. Otherwise, the user can choose another cell.