Langton's Ant Cellular Automata Grid

Build a self-painting 4-state cellular automaton in vanilla Minecraft where glowing laser pointers weave intricate geometric carpets across a white floor.

Java EditionComplex Contraptions & CinematicsEasy21 commandsTested on a real 26.2 & 26.3 server
Two glowing markers draw a symmetrical colored pattern across a white square grid in Minecraft. Download the GIF Video & GIF © www.9minecraft.net

SimulationsTechnologyWhiteBluePurpleLearningDecorationBlock displaysSummoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands

Watch mathematical order emerge from pure chaos right on your Minecraft floor. This command creation runs a 4-color variation of Langton's Ant, a classic two-dimensional cellular automaton where simple directional rules produce complex, symmetrical fractals and woven patterns without any pre-programmed blueprint.

Two glowing floating beacons race across a 29x29 white concrete canvas at 20 steps per second. Every time a beacon lands on a tile, it reads the block color below, rotates 90 degrees left or right, flips the tile to the next vibrant shade of cyan, magenta, or yellow, and leaves a burst of colorful sparks behind.

1. Setup - type these once 7 commands

  1. /fill ~-15 ~-1 ~-15 ~15 ~-1 ~15 minecraft:obsidian
  2. /fill ~-14 ~-1 ~-14 ~14 ~-1 ~14 minecraft:white_concrete
  3. /setblock ~ ~-1 ~ minecraft:cyan_concrete
  4. /setblock ~-1 ~-1 ~ minecraft:magenta_concrete
  5. /setblock ~ ~-1 ~-1 minecraft:yellow_concrete
  6. /summon minecraft:block_display ~ ~0.2 ~ {Tags:["c9_ant"],Rotation:[0f,0f],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:sea_lantern"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.5f,1.4f,0.5f],translation:[-0.25f,0f,-0.25f]}}
  7. /summon minecraft:block_display ~ ~0.2 ~ {Tags:["c9_ant"],Rotation:[180f,0f],Glowing:1b,glow_color_override:16711935,block_state:{Name:"minecraft:ochre_froglight"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.5f,1.4f,0.5f],translation:[-0.25f,0f,-0.25f]}}

2. Loop - one repeating command block each (Always Active) 14 commands

  1. /execute as @e[tag=c9_ant] at @s run tag @s remove c9_done
  2. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:white_concrete run tp @s ~ ~ ~ ~90 0
  3. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:white_concrete run particle minecraft:dust{color:[0.0,0.9,1.0],scale:1.5} ~ ~0.4 ~ 0.15 0.3 0.15 0 6
  4. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:white_concrete run setblock ~ ~-1 ~ minecraft:cyan_concrete
  5. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:cyan_concrete run tag @s add c9_done
  6. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:cyan_concrete run tp @s ~ ~ ~ ~-90 0
  7. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:cyan_concrete run particle minecraft:dust{color:[1.0,0.1,0.8],scale:1.5} ~ ~0.4 ~ 0.15 0.3 0.15 0 6
  8. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:cyan_concrete run setblock ~ ~-1 ~ minecraft:magenta_concrete
  9. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:magenta_concrete run tag @s add c9_done
  10. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:magenta_concrete run tp @s ~ ~ ~ ~90 0
  11. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:magenta_concrete run setblock ~ ~-1 ~ minecraft:yellow_concrete
  12. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:yellow_concrete run tag @s add c9_done
  13. /execute as @e[tag=c9_ant,tag=!c9_done] at @s if block ~ ~-1 ~ minecraft:yellow_concrete run tp @s ~ ~ ~ ~-90 0
  14. /execute as @e[tag=c9_ant] at @s run tp @s ^ ^ ^1

How it works

Frames from the test run

Langton's Ant Cellular Automata Grid - frame 1Langton's Ant Cellular Automata Grid - frame 2Langton's Ant Cellular Automata Grid - frame 3

Recorded on our own test server: 60 frames at about 9.9 fps. Our image check saw: Two glowing pink and cyan markers move across a large white square canvas, leaving a symmetrical cross-shaped pattern of blue, yellow, and purple blocks.

Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.

Build it in your world

  1. Stand at the center of a flat open area at least 35x35 blocks wide.
  2. Run each of the 7 setup commands once in chat to build the white grid, seed the center tiles, and summon the two glowing ant beacons.
  3. Place a repeating command block (Always Active) at the exact center coordinate, or wrap a chain of 14 command blocks with execute positioned at the grid center.
  4. Paste the 14 loop commands in exact order into your repeating command block and 13 chain command blocks (Always Active, Unconditional).
  5. Fly up above the board to watch the two ants interact and paint intricate patterns across the floor.

Use it with real players

You can join the grid as a live obstacle or seed painter by giving yourself boots that flip tiles under your feet: run /execute at @a if block ~ ~-1 ~ minecraft:white_concrete run setblock ~ ~-1 ~ minecraft:cyan_concrete in an extra repeating command block, then walk across the white floor to redirect the ants as they collide with your trail.

Remove it again 2 commands

  1. /kill @e[tag=c9_ant]
  2. /fill ~-15 ~-1 ~-15 ~15 ~-1 ~15 minecraft:grass_block

FAQ

Why do the commands use the c9_done tag between color checks?

All 14 loop commands run in the same single server tick. When white concrete turns into cyan concrete in command 4, the c9_done tag prevents command 6 from seeing the new cyan block and rotating the ant a second time during the same step.

What happens if an ant reaches the black obsidian border?

You can add one extra rule checking for obsidian that rotates the ant 180 degrees (~180 0) so it bounces cleanly back into the canvas, or keep the default symmetric seed which keeps both ants weaving near the center for hundreds of steps.

Commands used

/execute/fill/particle/setblock/summon/tag/tp

Similar creations

Join 9Minecraft News & Guides