Watch a live Breadth-First Search algorithm flood through a dark deepslate maze with glowing glass nodes to discover and highlight the shortest golden path.
SimulationsTechnologyDarkCyanPurpleGoldLearningMini-gameMap MakingBlock displaysSummoned mobsBlock building (fill/setblock/clone)21+ commands
This command creation turns your Minecraft world into a live computer science demonstration. Built on a dark obsidian and deepslate brick maze, a Breadth-First Search (BFS) algorithm automatically floods outward from an emerald start block in search of an amethyst goal.
As the search expands, frontier nodes glow bright cyan and emit sparks, while already-explored tiles settle into low purple glass. The moment the search reaches the amethyst target, it traces its parent pointers backward to light up the exact shortest path in bright gold.
/scoreboard objectives add c9_timer dummy/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:obsidian/fill ~-9 ~ ~-9 ~9 ~1 ~9 minecraft:deepslate_bricks/fill ~-7 ~ ~-7 ~7 ~1 ~7 minecraft:air/fill ~-5 ~ ~-7 ~-3 ~1 ~3 minecraft:deepslate_bricks/fill ~-1 ~ ~-3 ~1 ~1 ~7 minecraft:deepslate_bricks/fill ~3 ~ ~-7 ~5 ~1 ~3 minecraft:deepslate_bricks/setblock ~-7 ~-1 ~-7 minecraft:emerald_block/setblock ~7 ~-1 ~7 minecraft:amethyst_block/summon minecraft:marker ~ ~ ~ {Tags:["c9_ctrl","c9_sim"]}/execute as @e[type=minecraft:marker,tag=c9_ctrl] run scoreboard players add @s c9_timer 1/execute as @e[type=minecraft:marker,tag=c9_ctrl,scores={c9_timer=1}] at @s run kill @e[tag=c9_sim,tag=!c9_ctrl]/execute as @e[type=minecraft:marker,tag=c9_ctrl,scores={c9_timer=2}] at @s run summon minecraft:block_display ~-7 ~0.05 ~-7 {Tags:["c9_sim","c9_node","c9_open","c9_start"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.8f,0.45f,1.8f],translation:[-0.4f,0f,-0.4f]}}/execute as @e[type=minecraft:marker,tag=c9_ctrl,scores={c9_timer=2}] at @s run summon minecraft:block_display ~7 ~0.05 ~7 {Tags:["c9_sim","c9_goal_vis"],Glowing:1b,glow_color_override:16711935,block_state:{Name:"minecraft:magenta_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.8f,1.2f,1.8f],translation:[-0.4f,0f,-0.4f]}}/execute if entity @e[type=minecraft:marker,tag=c9_ctrl,scores={c9_timer=4..75}] as @e[tag=c9_open] run tag @s add c9_curr/execute as @e[tag=c9_curr] at @s positioned ~2 ~ ~ if block ~ ~ ~ minecraft:air unless entity @e[tag=c9_node,distance=..0.5] run summon minecraft:block_display ~ ~ ~ {Tags:["c9_sim","c9_node","c9_open","c9_from_w"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.8f,0.45f,1.8f],translation:[-0.4f,0f,-0.4f]}}/execute as @e[tag=c9_curr] at @s positioned ~-2 ~ ~ if block ~ ~ ~ minecraft:air unless entity @e[tag=c9_node,distance=..0.5] run summon minecraft:block_display ~ ~ ~ {Tags:["c9_sim","c9_node","c9_open","c9_from_e"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.8f,0.45f,1.8f],translation:[-0.4f,0f,-0.4f]}}/execute as @e[tag=c9_curr] at @s positioned ~ ~ ~2 if block ~ ~ ~ minecraft:air unless entity @e[tag=c9_node,distance=..0.5] run summon minecraft:block_display ~ ~ ~ {Tags:["c9_sim","c9_node","c9_open","c9_from_n"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.8f,0.45f,1.8f],translation:[-0.4f,0f,-0.4f]}}/execute as @e[tag=c9_curr] at @s positioned ~ ~ ~-2 if block ~ ~ ~ minecraft:air unless entity @e[tag=c9_node,distance=..0.5] run summon minecraft:block_display ~ ~ ~ {Tags:["c9_sim","c9_node","c9_open","c9_from_s"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:cyan_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.8f,0.45f,1.8f],translation:[-0.4f,0f,-0.4f]}}/execute as @e[tag=c9_curr] at @s run data merge entity @s {Tags:["c9_sim","c9_node","c9_closed"],glow_color_override:3355545,block_state:{Name:"minecraft:purple_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.6f,0.18f,1.6f],translation:[-0.3f,0f,-0.3f]}}/execute as @e[tag=c9_node,tag=!c9_path] at @s if block ~ ~-1 ~ minecraft:amethyst_block run tag @s add c9_path/execute as @e[tag=c9_path] at @s run tag @e[tag=c9_node,tag=!c9_path,distance=1.5..2.5] add c9_path/execute as @e[tag=c9_path,tag=!c9_styled] at @s run data merge entity @s {Tags:["c9_sim","c9_node","c9_path","c9_styled"],glow_color_override:16766720,block_state:{Name:"minecraft:yellow_stained_glass"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.85f,0.85f,1.85f],translation:[-0.425f,0f,-0.425f]}}/execute as @e[type=minecraft:marker,tag=c9_ctrl,scores={c9_timer=110..}] run scoreboard players set @s c9_timer 0setup #3 Builds the outer walls and interior dividers of the 19x19 maze using deepslate bricks over an obsidian floor.loop #3 At the start of each cycle, summons the initial cyan glowing block display node at the emerald start block.loop #6 Expands the search frontier east by 2 blocks into open air corridors if no node has visited that tile yet.loop #10 Converts expanded frontier nodes from cyan open states into flatter purple closed states so they do not expand twice.loop #11 Detects when a search node reaches the amethyst goal block and initiates the path backtracking tag.loop #13 Styles traced path nodes into tall, bright golden yellow blocks to display the solved route through the maze.


Recorded on our own test server: 58 frames at about 9.6 fps. Our image check saw: A dark deepslate and obsidian maze where glowing cyan and purple glass tiles expand down the left corridor.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
To turn this into an interactive maze solver that paths directly to you, remove setup command 8 (the fixed amethyst block) and change loop command 10 to check if entity @p[distance=..2] instead of checking for the amethyst block below. Wherever you stand inside the maze corridors, the golden path will dynamically trace the route from the emerald start to your feet.
/kill @e[tag=c9_sim]/scoreboard objectives remove c9_timer/fill ~-9 ~-1 ~-9 ~9 ~1 ~9 minecraft:air/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:grass_blockYes! The visualizer detects actual air blocks in 2-block grid steps from the start tile. You can break or place deepslate brick walls anywhere inside the border and the search wave will adapt on the next cycle.
Stepping by 2 blocks keeps the total number of block_display entities under 60 for the entire 19x19 arena, ensuring smooth performance without lag.
▶Magnetic Ferrofluid Audio VisualizerSimulationsHard24 cmds
▶Animated Logic-Gate Binary to Decimal ScoreboardSimulationsExpert24 cmds
▶Autonomous Cellular Grid: Conway's Game of Life in Vanilla MinecraftSimulationsMedium24 cmds
▶Illuminated Maze PathfinderSimulationsHard24 cmds
▶Smart Aiming Sentry vs. Classic Cannon ShowdownSimulationsExpert24 cmds
▶Spreading Glitch InfectionSimulationsMedium23 cmds