Skip to content

Commit

Permalink
docs(cellular): update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 8, 2022
1 parent 365123c commit a85e40c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions packages/cellular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ Result:
### Custom kernels & multiple rules

```ts
// create CA with 2 rules/kernels and 64 max age
import { multiColorGradient, srgb } from "@thi.ng/color";

// create CA with 2 rules/kernels (5-neighborhoods) and 64 states (max age)
const ca = new MultiCA1D(
[
{
Expand All @@ -235,15 +237,15 @@ const ca = new MultiCA1D(
WIDTH
);

// seed with 10% noise
// seed cells with 10% noise
ca.setNoise("cells", 0.1);

// set mask to stripe pattern to select both CAs
ca.setPattern("mask", WIDTH / 4, WIDTH / 2, 1, 0, WIDTH / 8);

// alternatively apply noise to the mask to create
// more uniformly hybrid/mixed results
// ca.setNoise("mask", 0.5, RND);
// ca.setNoise("mask", 0.5);

// create color gradient to visualize the different cell states
// and wrap as indexed color model for pixel buffer below...
Expand Down
8 changes: 5 additions & 3 deletions packages/cellular/tpl.readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ Result:
### Custom kernels & multiple rules

```ts
// create CA with 2 rules/kernels and 64 max age
import { multiColorGradient, srgb } from "@thi.ng/color";

// create CA with 2 rules/kernels (5-neighborhoods) and 64 states (max age)
const ca = new MultiCA1D(
[
{
Expand All @@ -193,15 +195,15 @@ const ca = new MultiCA1D(
WIDTH
);

// seed with 10% noise
// seed cells with 10% noise
ca.setNoise("cells", 0.1);

// set mask to stripe pattern to select both CAs
ca.setPattern("mask", WIDTH / 4, WIDTH / 2, 1, 0, WIDTH / 8);

// alternatively apply noise to the mask to create
// more uniformly hybrid/mixed results
// ca.setNoise("mask", 0.5, RND);
// ca.setNoise("mask", 0.5);

// create color gradient to visualize the different cell states
// and wrap as indexed color model for pixel buffer below...
Expand Down

0 comments on commit a85e40c

Please sign in to comment.