Skip to content

Jabolol/life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

life

A Game of Life implementation in Zig and WebAssembly.

installation

Make sure you have both Zig and Deno installed and on your $PATH.

  1. Clone the repository
git clone https://github.com/Jabolol/life.git .
  1. Build the WebAssembly file and patterns.json file using zig.
zig build
  1. Navigate to the www/ directory and start the website.
cd www && deno task start

custom patterns

Custom 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 0

Where 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 build

contributing

Contributions 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 www

license

This project is licensed under the MIT License.