Skip to content

[USER STORY] Logic for Lights Out game #88

@jody

Description

@jody

User Story

As a player, I want to play a game of Lights Out, so that I can enjoy the logic-puzzle-solving experience of this familiar game.

Acceptance Criteria

  • The default playing grid size is 5x5.
  • The initial state is randomized.
  • Input format allows for simple 0-based row column integer entry
  • Feedback to user includes ASCII art with row/column labels
  • Play continues until
    • all lights are off (success),
    • the player quits, or
    • the player requests to restart with the original configuration
  • No score is reported because not all configurations are winnable Anderson, M. and Feil, T. 1998

Notes

Design

  • Consider separating core grid logic from UI interaction, possibly using internal class(es), to facilitate testing and maintenance.
    • Internal classes might include a LightsOutBoard class that
      • Holds the grid and toggling logic
      • Can generate a random state or accept a seed (for pseudorandimization) or a grid for testing
      • Provides display logic

Testability

  • Consider providing for injection of an InputStream to facilitate testing. For example, include a no-parameter constructor that invokes a constructor that accepts parameter of type InputStream.

  • Consider deterministic board creation via a third constructor that also accepts an injected board to support repeatable test cases.

  • Encapsulate toggling logic in a single testable method.

Extensions

Consider the following extensions:

  • A parameterized constructor allows for an arbitrarily sized playing grid.
  • The initial state is guaranteed to be playable to a successful outcome.
    • Consider a LightsOutSolver and/or a BoardGenerator for guaranteed solvability and analysis of difficulty
  • Robust player input ("row,column", "row column", "(row, column)", etc.)

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    GamesAssociated with Games project

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions