pico-conway

Conway's game of life on a pico

MIT License

Stars
2

pico-conway

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.

build

hardware

Uses the Rasbperry Pi Pico or Pico2 with the Pimoroni pico-display-2

software

Requires pico-sdk and the pimoroni-pico](https://github.com/pimoroni/pimoroni-pico) libraries.

  1. fork or clone this repo.

  2. download and extract a release of the pico C/C++ SDK

  3. download and extract a release of pimoroni-pico. This is needed for the graphics library and display driver.

  4. download a cross-compiler e.g. g++-arm-none-eabi if necessary. Prebuilt riscv toolchains is available here

  5. edit CMakeLists.txt so that PICO_SDK_PATH and PIMORONI_PATH point to the correct locations

  6. 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)
  7. copy image to device (connected with BOOTSEL pressed), e.g.

    cp pico-conway.uf2 /media/<username>/RPI-RP2
    

test

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