feat(gameoflife): allow for variations to game of life (closes #1023) (#1041)

## What are the changes about?

Allows the game of life animation to be ran with configurable rules, specifically: the neighbors required for birth and survival.
### Example: [B3/S12345 (Maze)](https://conwaylife.com/wiki/OCA:Maze)
(where numbers after B are neighbors required for birth, and S for survival)
<video src="/attachments/49120c5e-ce21-4025-852e-924befbc2621" title="Screencast_20260814_233338" controls></video>

Introduces two keys to the config:
```ini
# Sets the multiple amounts of neighbors needed for a cell to survive.
# Each numerical digit from 0 to 8 inclusive in this string becomes
# one of the targets required for this cell to survive.
# Example: a string of "23" makes the cell survive on 2 or 3 neighbors
gameoflife_param_survival = "23"

# Sets the multiple amounts of neighbors needed for a cell to be born.
# Each numerical digit from 0 to 8 inclusive in this string becomes
# one of the targets required for this cell to be born.
# Example: a string of "3" makes the cell be born on 3 neighbors
gameoflife_param_birth = "3"
```

## What existing issue(s) does this resolve?

Solves !1023

## Pre-requisites

- [x] I have tested & confirmed the changes work locally
- [x] I have read and fully adhere to the rules set in the contributing guidelines found in `CONTRIBUTING.md`

Reviewed-on: https://codeberg.org/fairyglade/ly/pulls/1041
Reviewed-by: AnErrupTion <anerruption+codeberg@disroot.org>
This commit is contained in:
RadsammyT 2026-08-24 15:32:16 +02:00 committed by AnErrupTion
commit 0a29dc2fef
4 changed files with 37 additions and 5 deletions

View file

@ -65,6 +65,8 @@ gameoflife_fg: u32 = 0x0000FF00,
gameoflife_entropy_interval: usize = 10,
gameoflife_frame_delay: usize = 6,
gameoflife_initial_density: f32 = 0.4,
gameoflife_param_birth: []const u8 = "3",
gameoflife_param_survival: []const u8 = "23",
hide_borders: bool = false,
inactivity_cmd: ?[]const u8 = null,
inactivity_delay: u16 = 0,