86 lines
3.1 KiB
Markdown
86 lines
3.1 KiB
Markdown
|
|
# Spec Delta
|
||
|
|
|
||
|
|
## Purpose
|
||
|
|
|
||
|
|
Defines Conway's Game of Life simulation behavior, including ticking, pause/resume, stepping, speed control, and paused-only cell editing.
|
||
|
|
|
||
|
|
## ADDED Requirements
|
||
|
|
|
||
|
|
### Requirement: Simulation applies Conway's rules
|
||
|
|
The system SHALL advance the grid by one generation per tick using Conway's rules with wall boundaries.
|
||
|
|
|
||
|
|
#### Scenario: Tick advances grid
|
||
|
|
- **WHEN** a tick occurs
|
||
|
|
- **THEN** each cell's next state follows Conway's rules based on its eight neighbors
|
||
|
|
|
||
|
|
### Requirement: Simulation starts paused
|
||
|
|
The system SHALL start with the simulation paused.
|
||
|
|
|
||
|
|
#### Scenario: Initial state
|
||
|
|
- **WHEN** the application starts
|
||
|
|
- **THEN** the simulation is paused
|
||
|
|
|
||
|
|
### Requirement: Pause can be toggled
|
||
|
|
The system SHALL toggle between paused and running when the pause action is triggered.
|
||
|
|
|
||
|
|
#### Scenario: Toggle pause
|
||
|
|
- **WHEN** the user triggers the pause action
|
||
|
|
- **THEN** the simulation switches between paused and running
|
||
|
|
|
||
|
|
### Requirement: Single step advances one generation
|
||
|
|
The system SHALL advance exactly one generation when the step action is triggered while paused.
|
||
|
|
|
||
|
|
#### Scenario: Step while paused
|
||
|
|
- **WHEN** the simulation is paused and the user triggers step
|
||
|
|
- **THEN** the grid advances by one generation
|
||
|
|
- **AND** the simulation remains paused
|
||
|
|
|
||
|
|
### Requirement: Step is ignored while running
|
||
|
|
The system SHALL ignore the step action while the simulation is running.
|
||
|
|
|
||
|
|
#### Scenario: Step while running
|
||
|
|
- **WHEN** the simulation is running and the user triggers step
|
||
|
|
- **THEN** no extra generation is applied
|
||
|
|
|
||
|
|
### Requirement: Speed is adjustable
|
||
|
|
The system SHALL change the tick interval when speed_up or speed_down is triggered, within supported bounds.
|
||
|
|
|
||
|
|
#### Scenario: Speed up
|
||
|
|
- **WHEN** the user triggers speed_up
|
||
|
|
- **THEN** the tick interval decreases (simulation runs faster)
|
||
|
|
|
||
|
|
#### Scenario: Speed down
|
||
|
|
- **WHEN** the user triggers speed_down
|
||
|
|
- **THEN** the tick interval increases (simulation runs slower)
|
||
|
|
|
||
|
|
### Requirement: Cell editing only while paused
|
||
|
|
The system SHALL allow editing cells only while the simulation is paused.
|
||
|
|
|
||
|
|
#### Scenario: Edit while paused
|
||
|
|
- **WHEN** the simulation is paused and the user clicks a cell
|
||
|
|
- **THEN** the cell state changes according to the mouse button
|
||
|
|
|
||
|
|
#### Scenario: No edit while running
|
||
|
|
- **WHEN** the simulation is running and the user clicks a cell
|
||
|
|
- **THEN** the grid is not modified by the click
|
||
|
|
|
||
|
|
### Requirement: Left click sets cell alive
|
||
|
|
The system SHALL set the clicked cell to alive when the left mouse button is pressed while paused.
|
||
|
|
|
||
|
|
#### Scenario: Set alive
|
||
|
|
- **WHEN** the simulation is paused and the user left-clicks a cell
|
||
|
|
- **THEN** that cell becomes alive
|
||
|
|
|
||
|
|
### Requirement: Right click sets cell dead
|
||
|
|
The system SHALL set the clicked cell to dead when the right mouse button is pressed while paused.
|
||
|
|
|
||
|
|
#### Scenario: Set dead
|
||
|
|
- **WHEN** the simulation is paused and the user right-clicks a cell
|
||
|
|
- **THEN** that cell becomes dead
|
||
|
|
|
||
|
|
### Requirement: Drag paints cells
|
||
|
|
The system SHALL paint cells while dragging with the left button (alive) or right button (dead) while paused.
|
||
|
|
|
||
|
|
#### Scenario: Drag paint
|
||
|
|
- **WHEN** the simulation is paused and the user drags with left button held
|
||
|
|
- **THEN** cells under the cursor become alive
|