Hasty Briefsbeta

Bilingual

Simulating Infinity in Conway's Game of Life with Modern C++

2 days ago
  • #HashLife Algorithm
  • #C++23 Features
  • #Cellular Automata
  • GOLDE is a cellular automata editor and simulator built in modern C++, allowing trillions of generations to be simulated instantly.
  • HashLife algorithm is implemented using a memoized quadtree, with nodes caching future states to enable near-infinite evolution efficiently.
  • LifeNode structure uses const pointers for immutable canonical quadtrees, and LifeNodeArena provides bump-pointer allocation for memory management.
  • Base case precomputes 65,536 8x8 patterns at startup, using bitwise operations and lookup tables to accelerate calculations.
  • Bounded topologies like toroidal grids are supported via ghost cells and abstraction through LifeDataStructure, LifeAlgorithm, and Topology interfaces.
  • Exact generation jumps are achieved by decomposing step size into powers of 2 and using a custom cache keyed on node size and generation count.
  • Graceful stopping with std::jthread and std::stop_token ensures responsiveness and safety during user interruptions.
  • Thread-local static cache arrays allow efficient, thread-safe sharing of memoized data between simulation and editor threads.
  • GOLDE's design leverages modern C++23 features for safety and performance, with plans for extensions like multi-state rules and scripting.