feat: add 6 more built-in patterns (Beacon, Boat, Tub, Beehive, R-pentomino, Acorn)

Extend pattern module to 10 patterns and map them to digit keys 5-0.
Update config defaults and tests.
This commit is contained in:
2026-11-08 16:18:48 +01:00
parent 844778d30f
commit ed6c9c81f3
6 changed files with 74 additions and 8 deletions
+31 -1
View File
@@ -16,14 +16,44 @@ static const cell_offset_t toad_cells[] = {
{1,0},{2,0},{3,0},{0,1},{1,1},{2,1}
};
static const cell_offset_t beacon_cells[] = {
{0,0},{1,0},{0,1},{1,1},{2,2},{3,2},{2,3},{3,3}
};
static const cell_offset_t boat_cells[] = {
{0,0},{1,0},{0,1},{2,1},{1,2}
};
static const cell_offset_t tub_cells[] = {
{1,0},{0,1},{2,1},{1,2}
};
static const cell_offset_t beehive_cells[] = {
{1,0},{2,0},{0,1},{3,1},{1,2},{2,2}
};
static const cell_offset_t rpent_cells[] = {
{1,0},{2,0},{0,1},{1,1},{1,2}
};
static const cell_offset_t acorn_cells[] = {
{1,0},{3,1},{0,2},{1,2},{2,2},{3,2},{4,2}
};
static const pattern_t patterns[] = {
{"glider", 5, glider_cells},
{"blinker", 3, blinker_cells},
{"block", 4, block_cells},
{"toad", 6, toad_cells},
{"beacon", 8, beacon_cells},
{"boat", 5, boat_cells},
{"tub", 4, tub_cells},
{"beehive", 6, beehive_cells},
{"rpentomino", 5, rpent_cells},
{"acorn", 7, acorn_cells},
};
int pattern_count(void) { return 4; }
int pattern_count(void) { return 10; }
const pattern_t *pattern_get(int index) {
if (index < 0 || index >= pattern_count()) return NULL;