@wonderyard/vivarium 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,24 +40,24 @@ import { vivarium, setup } from "@wonderyard/vivarium";
|
|
|
40
40
|
|
|
41
41
|
### Create
|
|
42
42
|
|
|
43
|
-
To give you an idea of what the API can offer and how intuitive it can be to reason about rules and conditions, we recreated the most popular cellular automaton: [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life). Now featuring (with a little bit of imagination)
|
|
43
|
+
To give you an idea of what the API can offer and how intuitive it can be to reason about rules and conditions, we recreated the most popular cellular automaton: [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life). Now featuring (with a little bit of imagination) green aliens 👽
|
|
44
44
|
|
|
45
45
|
> We suggest you to read about Game of Life and how it works before continuing reading. If you don't understand clearly what the following code is representing, it's okay! Visit the [docs](https://vivarium.orangenote.dev) for a gentler introduction to cellular automata and what vivarium is meant for.
|
|
46
46
|
|
|
47
47
|
```typescript
|
|
48
48
|
const vi = vivarium();
|
|
49
49
|
|
|
50
|
-
const space = vi.element("space", "
|
|
51
|
-
const
|
|
50
|
+
const space = vi.element("space", "blue");
|
|
51
|
+
const alien = vi.element("alien", "green");
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
space.to(
|
|
53
|
+
// An alien is born if there's a family of 3 in the area.
|
|
54
|
+
space.to(alien).count(alien, 3);
|
|
55
55
|
|
|
56
|
-
// The
|
|
57
|
-
|
|
56
|
+
// The alien stays if the area is neither too empty nor too crowded...
|
|
57
|
+
alien.to(alien).count(alien, 2, 3);
|
|
58
58
|
|
|
59
|
-
// ...otherwise the
|
|
60
|
-
|
|
59
|
+
// ...otherwise the alien will leave the area forever.
|
|
60
|
+
alien.to(space);
|
|
61
61
|
|
|
62
62
|
const life = vi.create();
|
|
63
63
|
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderyard/vivarium",
|
|
3
3
|
"description": "Modern, intuitive, WebGPU-powered toolkit for creating your own cellular automata.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"repository": "https://github.com/WonderYard/vivarium",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "OrangeNote",
|