Conway's Game of Life made for elementary OS.
A game of life showcasing the default (light) style | A game of life showcasing the dark style |
For more screenshots check out the screenshots directory.
The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.
- First up, major kudos goes to John Conway for coming up with the Game of Life in the first place. Without him none of this would be possible. But also to all the mathematicians, both professional and hobbyist, who have contributed to today's understanding of this wonderful phenomena. Among them, extra kudos goes to contributors and maintainers of the LifeWiki, a wiki dedicated to the Game of Life. Browsing their articles motivated me to create this app, and I used materals from the wiki as a source for the Patterns Library feature.
- There are many approaches to implementing the Game of Life in a computer program. This app uses a genius Hashlife algorithm devised by Bill Gosper. In addition to him, kudos goes to Eric Lippert for explaining Hashlife, and many other algorithms, in a wonderful series on Game of Life implementations on his Fabulous adventures in coding blog. Without Eric's approachable and yet highly detailed writing I would not have been able to make this app.
- While on the subject of algorithms, kudos also to Prof. Ketan Shah, Anirban Mitra and Dhruv Matani for their constant time algorithm for least frequently used cache. Hashlife heavily depends on caching, and this cache implementation is efficient and elegant. Kudos also goes to Arpit Bhayani for explaining the algorithm in a beautifully crafted blog post.
- Last but not least, kudos goes to the elementary team for building and maintaining such a solid platform and a welcoming environment for app developers, with special thanks to Danielle Foré or running the show.
Life is in active development. It currently supports following set of features:
- App can run a Game of Life simulation at various speeds with automatically expanding simulation boundaries.
- User can draw and erase live cells to create patterns in the simulation.
- User can edit cells by copying / pasting, rotating and flipping a selection.
- User can explore an included Patterns Library to discover building blocks of larger Game of Life patterns.
- User can save / open cell patterns into / from files.
- App remembers and restores current pattern of cells between restarts.
- Operations of running the simulation, writing to files and interacting with the UI don't block each other.
- User without previous knowledge of Game of Life can learn basics from a built-in primer.
I'm also considering adding some features after the initial release:
- Support for multiple file formats.
- Option to export evolving simulation in a video or a gif image.
- Helper tools for crafting patterns, for example rulers or advanced cell highlights.
- More advanced filter and search over the Patterns Library.
- Adding more patterns into the Patterns Library.
Check out GitHub issues for more details.
If you want to you can build Life locally, from source. You can find detailed instructions for setting up local environment in elementary developer docs.
Life app is based on the elementary OS 7 platform. Currently this version of the OS is in early access, although a release is expected soon. You can build the app with meson from an OS 7. Alternatively, you can build it from any other operating system with flatpak.
You may need to install elementary flatpak runtime first. You can do that with:
flatpak install --user io.elementary.Sdk//7
To install Life use flatpak-builder
, from project root directory run:
flatpak-builder build hr.from.josipantolis.life.yml --user --install --force-clean
then run it with with:
flatpak run hr.from.josipantolis.life
⚠️ Warning⚠️ This does require elementary OS 7, which is currently in early access.
You can meet all dependencies by installing elementary SDK and GSL:
sudo apt install elementary-sdk libgsl-dev
For a full list of dependencies check out the meson.build file.
Run meson build
to configure build environment. Change into the build directory and run ninja
to build
meson build --prefix=/usr
cd build
ninja
To install, use ninja install
, then execute with hr.from.josipantolis.life
ninja install
hr.from.josipantolis.life
To generate translation files execute
ninja hr.from.josipantolis.life-pot
ninja extra-pot
ninja hr.from.josipantolis.life-update-po
ninja extra-update-po
Copyright © 2022 Josip Antoliš, [email protected].