Conway's Game of Life, written in C# with GTK for the UI. I built this in 2023 as a first-year project at Charles University, so treat it as early work rather than a polished piece of software.
The rules are the standard ones: a grid of cells, each alive or dead, and each
generation is decided by how many live neighbours a cell has. You pick a
starting pattern from a menu, watch it evolve, and can pause it with the space
bar. There's a handful of classic patterns bundled in StartingStates/
(glider, pulsar, Gosper's glider gun, and others), plus a random option.
- .NET SDK, targeting net7.0 (built and tested against the .NET 7 and .NET 8 SDKs)
- GTK3 installed natively, since GtkSharp is a binding over the system GTK
libraries rather than a bundled one. On macOS:
brew install gtk+3. Most Linux distributions have GTK3 already; on Windows the GtkSharp NuGet package pulls in the runtime it needs.
dotnet build
dotnet run
Both commands need to be run from the repository root, next to
Game-of-Life.csproj. dotnet run opens a window with the grid and a menu
bar for choosing a starting state, a speed control (slow/medium/fast), and a
life span setting if you want the simulation to stop after a fixed number of
generations rather than run forever.
Model.cs: the grid and the generation rulesView.cs: the GTK window, drawing, and controlsStartingStates/: plain text files, one character per cell,1for alive and0for dead, used to seed a pattern
This was my first time working with GTK, or with a graphics/UI library in C# generally, so some of the design choices (mutable state passed around between the window and the view, for one) are what a first-year student version of me thought was reasonable at the time. It runs and does what it says, but I wouldn't hold it up as an example of how I'd write it now.
