Build a self-solving BFS maze grid in vanilla Minecraft where glowing yellow search waves expand around crying obsidian barriers to reach a redstone goal.
SimulationsTechnologyYellowCyanGreenLearningMini-gameMap MakingBlock building (fill/setblock/clone)21+ commands
Watch a computer science pathfinding algorithm come to life right on your world floor. Starting from an emerald origin tile, a breadth-first search (BFS) frontier expands outward in glowing yellow waves across a gray concrete arena, turning visited tiles cyan as it navigates around crying obsidian walls.
Each step of the search spawns bright particle bursts and plays crisp chime notes until the frontier discovers the redstone goal block, triggering a celebration beam.
/scoreboard objectives add c9_t dummy/scoreboard objectives add c9_d dummy/scoreboard players set #4 c9_t 4/fill ~-8 ~-1 ~-8 ~8 ~-1 ~8 polished_blackstone_bricks/fill ~-7 ~-1 ~-7 ~7 ~-1 ~7 gray_concrete/fill ~-3 ~-1 ~-7 ~-3 ~1 ~2 crying_obsidian/fill ~3 ~-1 ~-2 ~3 ~1 ~7 crying_obsidian/setblock ~-6 ~-1 ~-6 emerald_block/setblock ~6 ~-1 ~6 redstone_block/summon marker ~-6 ~ ~-6 {Tags:["c9_m","c9_ctrl","c9_head"]}/scoreboard players add @e[tag=c9_ctrl] c9_t 1/scoreboard players operation @e[tag=c9_ctrl] c9_d = @e[tag=c9_ctrl,limit=1] c9_t/scoreboard players operation @e[tag=c9_ctrl] c9_d %= #4 c9_t/execute if score @e[tag=c9_ctrl,limit=1] c9_d matches 0 unless entity @e[tag=c9_win] as @e[tag=c9_head] at @s align xyz positioned ~0.5 ~ ~0.5 run summon area_effect_cloud ~1 ~ ~ {Tags:["c9_m","c9_cand"],Duration:5}/execute if score @e[tag=c9_ctrl,limit=1] c9_d matches 0 unless entity @e[tag=c9_win] as @e[tag=c9_head] at @s align xyz positioned ~0.5 ~ ~0.5 run summon area_effect_cloud ~-1 ~ ~ {Tags:["c9_m","c9_cand"],Duration:5}/execute if score @e[tag=c9_ctrl,limit=1] c9_d matches 0 unless entity @e[tag=c9_win] as @e[tag=c9_head] at @s align xyz positioned ~0.5 ~ ~0.5 run summon area_effect_cloud ~ ~ ~1 {Tags:["c9_m","c9_cand"],Duration:5}/execute if score @e[tag=c9_ctrl,limit=1] c9_d matches 0 unless entity @e[tag=c9_win] as @e[tag=c9_head] at @s align xyz positioned ~0.5 ~ ~0.5 run summon area_effect_cloud ~ ~ ~-1 {Tags:["c9_m","c9_cand"],Duration:5}/execute if score @e[tag=c9_ctrl,limit=1] c9_d matches 0 unless entity @e[tag=c9_win] as @e[tag=c9_head] at @s if block ~ ~-1 ~ yellow_concrete run setblock ~ ~-1 ~ cyan_concrete/execute if score @e[tag=c9_ctrl,limit=1] c9_d matches 0 as @e[tag=c9_head] run tag @s remove c9_head/execute as @e[tag=c9_cand] at @s if block ~ ~-1 ~ redstone_block run tag @e[tag=c9_ctrl] add c9_win/execute as @e[tag=c9_cand] at @s if block ~ ~-1 ~ gray_concrete run setblock ~ ~-1 ~ yellow_concrete/execute as @e[tag=c9_cand] at @s if block ~ ~-1 ~ yellow_concrete unless entity @e[tag=c9_head,distance=..0.4] run tag @s add c9_head/execute as @e[tag=c9_head] at @s run particle dust{color:[1.0,0.9,0.1],scale:1.8} ~ ~0.4 ~ 0.2 0.2 0.2 0 4 force/execute if entity @e[tag=c9_win] run particle totem_of_undying ~6 ~1.5 ~6 0.4 1.2 0.4 0.15 12 forceloop #3 Uses modulo arithmetic (<code>%= #4</code>) on the master timer so the breadth-first search expands cleanly once every 4 ticks (5 steps per second).loop #4 Every 4th tick, each active frontier node (<code>c9_head</code>) spawns short-lived candidate markers in the 4 cardinal directions (+X, -X, +Z, -Z).loop #8 Turns the current yellow frontier blocks into cyan concrete once they have finished expanding to their neighbors, leaving behind a clean visited area.loop #11 Validates candidate nodes: only candidates standing above unvisited <code>gray_concrete</code> claim the tile by turning it into <code>yellow_concrete</code>.loop #12 Promotes one candidate on each newly claimed yellow tile to become the next generation of <code>c9_head</code> frontier nodes, while unused candidates expire automatically after 5 ticks.


Recorded on our own test server: 43 frames at about 7.1 fps. Our image check saw: A gray concrete arena with crying obsidian walls shows a yellow frontier wave expanding from an emerald block, leaving cyan tiles and blue/white particles behind as it moves toward a redstone block.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
You can edit the maze walls live while the wave expands or build custom puzzles before launching the wave. To trigger the solver manually with an item instead of starting immediately, remove "c9_head" from setup command 10 and run /execute at @p run summon area_effect_cloud ~ ~ ~ {Tags:["c9_m","c9_head"],Duration:5} wherever a player stands on the grid.
/kill @e[tag=c9_m]/scoreboard objectives remove c9_t/scoreboard objectives remove c9_d/fill ~-8 ~-1 ~-8 ~8 ~-1 ~8 grass_block/fill ~-8 ~ ~-8 ~8 ~2 ~8 airEach candidate is an Area Effect Cloud with a Duration of 5 ticks. Since the wave advances every 4 ticks, only the active 1D frontier edge exists at any moment and old nodes vanish automatically.
Yes! Because the wave only steps onto gray_concrete and stops at redstone_block, any other block you place on the floor acts as a solid wall.
▶Four-Dimensional Hypercube Tesseract RotationSimulationsExpert24 cmds
▶Holographic DNA Double-Helix SplicerSimulationsHard24 cmds
▶Magnetic Ferrofluid Audio VisualizerSimulationsHard24 cmds
▶Microscopic Bacteriophage Viral InjectionSimulationsHard24 cmds
▶Monumental Dam Spillway Floodgate ReleaseSimulationsHard24 cmds