62 lines
1.6 KiB
Markdown
62 lines
1.6 KiB
Markdown
# Conway's Game of Life
|
|
|
|
A simple implementation of Conway's Game of Life, built with vanilla JS and a canvas element.
|
|
|
|
## Features
|
|
|
|
- Play/pause, step one generation, clear, randomize
|
|
- Draw or erase cells by clicking and dragging
|
|
- Speed and zoom sliders
|
|
- Preset patterns: block, blinker, toad, beacon, glider, LWSS, pulsar, Gosper glider gun
|
|
- Fixed edges or toroidal wrapping
|
|
- Grid toggle, generation counter, live-cell counter
|
|
- Import/export board as JSON or compact text
|
|
- Dark/light theme
|
|
- Keyboard shortcuts
|
|
|
|
## Running locally
|
|
|
|
No build step, just static files.
|
|
|
|
```bash
|
|
git clone https://gitea.nalakath.org/aman/conways-game-of-life.git
|
|
cd conways-game-of-life
|
|
python3 -m http.server 8080
|
|
```
|
|
|
|
Open `http://localhost:8080`.
|
|
|
|
## Deploying (WIP)
|
|
|
|
**Nginx / Caddy, serving the repo directly**
|
|
|
|
```nginx
|
|
server {
|
|
listen 80;
|
|
server_name life.example.com;
|
|
root /srv/www/conway_gameoflife;
|
|
index index.html;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|
|
```
|
|
|
|
```
|
|
life.example.com {
|
|
root * /srv/www/conway_gameoflife
|
|
file_server
|
|
try_files {path} /index.html
|
|
}
|
|
```
|
|
|
|
**Gitea Actions**, copying files to a server path or object storage. There's a basic `ci.yml` in `.gitea/workflows/` that checks required files exist and that the JS is syntactically valid. Extend it for your own deploy target.
|
|
|
|
All paths are relative (`./style.css`, `./js/app.js`), so it works at the domain root or under a subpath like `/apps/life/`. Keep `index.html`, `style.css`, and `js/` together.
|
|
|
|
## Ideas for later
|
|
|
|
- Infinite canvas with panning
|
|
- Better touch controls for mobile
|
|
- Rotate/mirror patterns before stamping |