Conway's game of life on a pico
MIT License
Cellular automata on a pico...
Cells are colour-coded according to their age. Button A resets, B clears the screen, X adds a randomly-placed glider (this happens randomly without pressing anything). Y toggles screen brightness.
Pico2 allows for a 160x120 cell domain, memory restrictions mean the original Pico can only support 106x80.
Uses the Rasbperry Pi Pico or Pico2 with the Pimoroni pico-display-2
Requires pico-sdk and the pimoroni-pico](https://github.com/pimoroni/pimoroni-pico) libraries.
fork or clone this repo.
download and extract a release of the pico C/C++ SDK
download and extract a release of pimoroni-pico. This is needed for the graphics library and display driver.
download a cross-compiler e.g. g++-arm-none-eabi if necessary. Prebuilt riscv toolchains is available here
edit CMakeLists.txt so that PICO_SDK_PATH and PIMORONI_PATH point to the correct locations
build the image for the intended platform, optionally supplying the toolchain path (if not in $PATH
), e.g.
mkdir -p build
cd build
cmake -DPICO_PLATFORM=rp2350-riscv -DPICO_TOOLCHAIN_PATH=/opt/riscv-gcc-14 ..
make -j
Valid values for PICO_PLATORM
are:
rp2040
(Cortex M0+)rp2350
or rp2350-arm-s
(Cortex M33+)rp2350-riscv
(Hazard 3)copy image to device (connected with BOOTSEL
pressed), e.g.
cp pico-conway.uf2 /media/<username>/RPI-RP2
The algorithm itself can be tested/debugged on the host machine using the test harness, e.g.:
g++ -g -O0 -Wall -Werror --std=c++20 src/test_conway.cpp src/conway.cpp -o test