Skip to content

LightsOut programming: level 2 #8

Description

@atodorov
  • when play mode starts it will initialize a predefined number of LEDs = X
  • X == 5 - level number, in this case X == 5 - 2 == 3
  • leds that light up should be chosen randomly from the entire matrix. If easier think about them as X random out of 16!
  • In play mode each button press controls groups of buttons using inversion (like in the original LO):
    • if lighted up => go dark
    • if dark => light up
  • Each level uses a different geometric shape to define the group which is controlled via single button press:
    • For level 2 this is an inverted L shape - the pressed button, the one to the right of it on the same row; the button immediately below the corner piece, see LightsOut sources: general logic #5 for image
  • Some board configurations will not lead to a successful solution if you are trying to play the classical LO game. This is fine; no checking for this.
  • For the corner buttons the following implementation(s) are acceptable:
    • either consider that you have phantom rows/columns on all sides (to make the algorithm straight forward and not do any error checks) or
    • if easier check if the resulting (horizontal, vertical) address represents an invalid location (e.g. no such physical LED + button) and skip it.

For more info see #5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions