Watch a glowing wave of cyan glass ripple through a stone labyrinth to find the exit, then trace the shortest golden path back to the start.
SimulationsTechnologyCyanYellowGreenLearningMini-gameMap MakingArmor standsBlock building (fill/setblock/clone)21+ commands
This command creation builds a stone brick labyrinth and solves it right before your eyes using the Breadth-First Search (BFS) flood-fill algorithm. A glowing wave of cyan glass ripples outward from the green start pad into every corridor until it reaches the red exit.
Once the exit is discovered, a golden homing orb traces the distance values backward step-by-step to illuminate the shortest route with glowing yellow glass and fireworks, then automatically resets the maze for another cycle.
/scoreboard objectives add c9_dist dummy/scoreboard objectives add c9_timer dummy/scoreboard objectives add c9_step dummy/scoreboard objectives add c9_min dummy/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 polished_deepslate/fill ~-9 ~ ~-9 ~9 ~1 ~9 stone_bricks/fill ~-7 ~ ~-7 ~7 ~1 ~7 air/fill ~-5 ~ ~-5 ~5 ~1 ~5 stone_bricks/fill ~-3 ~ ~-3 ~3 ~1 ~3 air/fill ~-1 ~ ~-1 ~1 ~1 ~1 stone_bricks/execute unless entity @e[tag=c9_ctrl] run summon marker ~ ~ ~ {Tags:["c9_ctrl"]}/scoreboard players add @e[tag=c9_ctrl] c9_timer 1/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 positioned ~ ~ ~ run fill ~-7 ~ ~-7 ~7 ~ ~7 air replace cyan_stained_glass/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 positioned ~ ~ ~ run fill ~-7 ~ ~-7 ~7 ~ ~7 air replace yellow_stained_glass/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 positioned ~ ~ ~ run kill @e[tag=c9_node]/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 2 positioned ~ ~ ~ run fill ~-5 ~ ~ ~-5 ~1 ~ air/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 2 positioned ~ ~ ~ run fill ~ ~ ~5 ~ ~1 ~5 air/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 2 positioned ~ ~ ~ run fill ~3 ~ ~-4 ~7 ~1 ~-4 stone_bricks/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 2 positioned ~ ~ ~ run fill ~-7 ~ ~2 ~-5 ~1 ~2 stone_bricks/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 3 positioned ~ ~ ~ run setblock ~-7 ~-1 ~-7 emerald_block/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 3 positioned ~ ~ ~ run setblock ~7 ~-1 ~7 redstone_block/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 3 positioned ~ ~ ~ run summon armor_stand ~-7 ~ ~-7 {Tags:["c9_node","c9_front"],Invisible:1b,Marker:1b,NoGravity:1b}/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 4..110 as @e[tag=c9_front] at @s run execute store result score @s c9_step run scoreboard players get @e[tag=c9_ctrl,limit=1] c9_timer/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 4..110 as @e[tag=c9_front] at @s unless entity @e[tag=c9_goal] run fill ~-1 ~ ~ ~1 ~ ~ cyan_stained_glass replace airsetup #6 Builds the outer walls and rings of the stone brick labyrinth on top of the polished deepslate floor.loop #6 Carves openings and adds blocker walls inside the concentric rings so the flood wave has to navigate around dead ends and corridors.loop #12 Spawns the initial frontier marker on the emerald start block in the corner of the maze.loop #14 Expands the cyan stained glass flood wave outward from active frontier nodes into adjacent open air corridors.


Recorded on our own test server: 56 frames at about 9.2 fps. Our image check saw: A stone brick maze is filled with cyan glass blocks while glowing yellow blocks trace a path from a red block back toward a green start block.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
To let a player start the flood-fill from wherever they are standing inside a custom maze, replace the fixed coordinates in loop command 12 with /execute at @p run summon armor_stand ~ ~ ~ {Tags:["c9_node","c9_front"],Invisible:1b,Marker:1b,NoGravity:1b}.
/kill @e[tag=c9_ctrl]/kill @e[tag=c9_node]/scoreboard objectives remove c9_dist/scoreboard objectives remove c9_timer/scoreboard objectives remove c9_step/scoreboard objectives remove c9_min/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 grass_block/fill ~-9 ~ ~-9 ~9 ~2 ~9 airYes! You can break or place any stone_bricks inside the 15x15 interior area and the flood-fill wave will automatically navigate around your new walls.
Stained glass lets you see the emerald start pad and redstone exit block underneath while prevented already-visited tiles from being searched twice.
▶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