Catalog/gen-cellular-automata

Generators

Cellular automata step API

Advances a cellular automaton by N steps: Conway's Game of Life (B3/S23, bounded grid) or a 1D elementary rule-N (0-255, periodic boundaries). The value-add: correct neighbor counting and rule-bit lookup, deterministic and pure. Answers 'Step Conway's Life forward', 'Compute elementary CA rule 30 for this row.'.

Price$0.02per request
MethodPOST
Route/v1/generate/cellular-automata
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
cellular-automataconwaygame-of-liferule-30elementarydeterministicsimulationgenerate
API URLhttps://x402.hexl.dev/v1/generate/cellular-automata
Integration docs
Example request
{
  "mode": "elementary",
  "row": [
    0,
    0,
    0,
    1,
    0,
    0,
    0
  ],
  "rule": 30,
  "steps": 2
}
Example response
{
  "mode": "elementary",
  "result": [
    0,
    1,
    1,
    0,
    0,
    1,
    0
  ],
  "history": [
    [
      0,
      0,
      0,
      1,
      0,
      0,
      0
    ],
    [
      0,
      0,
      1,
      1,
      1,
      0,
      0
    ],
    [
      0,
      1,
      1,
      0,
      0,
      1,
      0
    ]
  ],
  "rule": 30,
  "steps": 2,
  "width": 7,
  "boundary": "periodic",
  "deterministic": true,
  "interpretation": "Elementary CA rule 30 advanced 2 step(s) with periodic boundaries."
}
Input schema
{
  "type": "object",
  "required": [
    "mode"
  ],
  "properties": {
    "mode": {
      "type": "string",
      "enum": [
        "conway",
        "elementary"
      ],
      "examples": [
        "elementary"
      ]
    },
    "grid": {
      "type": "array",
      "description": "2D 0/1 array (conway)",
      "examples": [
        [
          [
            0,
            1,
            0
          ],
          [
            0,
            1,
            0
          ],
          [
            0,
            1,
            0
          ]
        ]
      ]
    },
    "row": {
      "type": "array",
      "description": "1D 0/1 array (elementary)",
      "examples": [
        [
          0,
          0,
          0,
          1,
          0,
          0,
          0
        ]
      ]
    },
    "rule": {
      "type": "integer",
      "minimum": 0,
      "maximum": 255,
      "examples": [
        30
      ]
    },
    "steps": {
      "type": "integer",
      "minimum": 1,
      "maximum": 200,
      "examples": [
        2
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}