A Game of Life
implementation in Zig and WebAssembly.
Make sure you have both Zig and
Deno installed and on your $PATH.
- Clone the repository
git clone https://github.com/Jabolol/life.git .- Build the
WebAssemblyfile andpatterns.jsonfile usingzig.
zig build- Navigate to the
www/directory and start the website.
cd www && deno task startCustom patterns consist of files in the assets/ directory. The
format of these files is as follows:
0 0 0 0 0 0
0 0 1 1 0 0
0 1 0 0 1 0
0 0 1 1 0 0
0 0 0 0 0 0Where 0 is a dead cell and 1 is a live cell. There is a space between each
cell and a newline between each row.
Every time you change a file in the assets/ directory, you need
to rebuild the patterns.json file using zig.
The pattern is automatically centered on the canvas.
zig buildContributions are welcome. Please open an issue or a pull request. Please run the following commands before opening a pull request, and ensure that they all pass.
# zig specific commands
zig fmt src
zig fmt www/static/patterns.json
zig test src/main.zig
zig test src/pattern.zig
zig build
# deno specific commands
deno fmt www
deno lint wwwThis project is licensed under the MIT License.