Add build instructions and make lurker optional
parent
d4671efb5a
commit
212948b1c4
|
@ -0,0 +1,46 @@
|
|||
# cellular automata toys in löve2d
|
||||
|
||||
## toys
|
||||
|
||||
### ants
|
||||
|
||||
langton's ant, heavily inspired by Andrew Healey's [blog post](https://healeycodes.com/virtual-ants) and [code](https://github.com/healeycodes/virtual-ants).
|
||||
|
||||
supports multiple colors by passing a custom set of rules, see [wikipedia](https://en.wikipedia.org/wiki/Langton%27s_ant#Extension_to_multiple_colors).
|
||||
|
||||
click on the screen to spawn new ants.
|
||||
|
||||
### life
|
||||
|
||||
conway's game of life. supports other life-like cellular automata rules, see [wikipedia](https://en.wikipedia.org/wiki/Life-like_cellular_automaton#A_selection_of_Life-like_rules)
|
||||
|
||||
left click or click and drag to flip cells on, and right click to spawn a glider.
|
||||
|
||||
## colorbrewer
|
||||
|
||||
this repo includes a lua interface to [the lovely and accessible ColorBrewer2 colorschemes based on the research of Dr. Cynthia Brewer](https://colorbrewer2.org), based on [the original ColorBrewer code](https://github.com/axismaps/colorbrewer/) and the implementation in [Chroma.js](https://github.com/gka/chroma.js/).
|
||||
|
||||
## running the toys
|
||||
|
||||
if you have [löve](https://github.com/love2d/love) installed on your system, you can just run the toys by name:
|
||||
|
||||
```bash
|
||||
love ants
|
||||
# run with a cool square pattern
|
||||
love ants LRRRRRLLR
|
||||
# other options
|
||||
love ants <rule> <grid-unit-width-px> <simulation-steps-per-frame>
|
||||
|
||||
love life
|
||||
# run with HighLife rules
|
||||
love life B36/S23
|
||||
# other options
|
||||
love life <rule> <grid-unit-width-px> <simulation-steps-per-frame>
|
||||
```
|
||||
|
||||
if you have [nix](https://nixos.org), you can use the provided flake.nix to get a working environment for running the games, as well as support for hot reloading if you want to hack on them.
|
||||
|
||||
```bash
|
||||
nix develop
|
||||
love ...
|
||||
```
|
|
@ -132,7 +132,9 @@ function love.mousepressed(x, y)
|
|||
end
|
||||
|
||||
function love.update()
|
||||
pcall(function()
|
||||
require("lurker").update()
|
||||
end)
|
||||
for _ = 1, STEPS_PER_FRAME do
|
||||
for i, ant in pairs(ANTS) do
|
||||
local c = nextColor(ant)
|
||||
|
|
|
@ -131,7 +131,9 @@ end
|
|||
FRAMELOCK_COUNTER = 0
|
||||
FRAMELOCK_FPS = 30
|
||||
function love.update(dt)
|
||||
pcall(function()
|
||||
require("lurker").update()
|
||||
end)
|
||||
FRAMELOCK_COUNTER = FRAMELOCK_COUNTER + dt
|
||||
if FRAMELOCK_COUNTER < (1 / FRAMELOCK_FPS) then
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue