Watch a live 3D Breadth-First Search algorithm expand cyan display cubes around floating purple glass barriers in Minecraft to find the shortest path.
SimulationsTechnologyCyanPurpleGreenLearningMap MakingBlock displaysBlock building (fill/setblock/clone)21+ commands
This command creation builds a live 3D breadth-first search (BFS) visualizer inside Minecraft. Starting from a glowing emerald block on the left, cyan display cubes expand outward in six directions across a three-dimensional lattice, automatically navigating around and over floating purple glass walls to reach the beacon target on the right.
Once the search wave reaches the destination, a golden path tracer steps backward along the distance gradient, highlighting the optimal 3D route in glowing gold blocks and end rod particles before resetting for another cycle.
/scoreboard objectives add c9_sys dummy/scoreboard objectives add c9_dist dummy/scoreboard players set #tick c9_sys 0/fill ~-9 ~-1 ~-7 ~9 ~-1 ~7 minecraft:deepslate_tiles/fill ~-4 ~1 ~-1 ~-4 ~9 ~6 minecraft:purple_stained_glass/fill ~0 ~1 ~-6 ~0 ~9 ~0 minecraft:purple_stained_glass/fill ~4 ~1 ~-1 ~4 ~5 ~6 minecraft:purple_stained_glass/summon marker ~0 ~4 ~0 {Tags:["c9_center"]}/summon block_display ~-6 ~2 ~0 {Tags:["c9_node","c9_start","c9_front"],Glowing:1b,glow_color_override:5635925,block_state:{Name:"minecraft:emerald_block"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.35f,-0.35f,-0.35f],scale:[0.7f,0.7f,0.7f]}}/summon block_display ~6 ~6 ~0 {Tags:["c9_goal"],Glowing:1b,glow_color_override:16755200,block_state:{Name:"minecraft:beacon"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[-0.45f,-0.45f,-0.45f],scale:[0.9f,0.9f,0.9f]}}/scoreboard players add #tick c9_sys 1/execute if score #tick c9_sys matches 95.. run scoreboard players set #tick c9_sys 1/execute if score #tick c9_sys matches 1 run kill @e[tag=c9_tmp]/execute if score #tick c9_sys matches 1 as @e[tag=c9_start] run tag @s add c9_front/execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~2 ~ ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],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],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}/execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~-2 ~ ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],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],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}/execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~2 ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],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],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}/execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~-2 ~ if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],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],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}/execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~ ~2 if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],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],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}/execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] at @s positioned ~ ~ ~-2 if block ~ ~ ~ air unless block ~ ~-1 ~ minecraft:deepslate_tiles unless entity @e[tag=c9_node,distance=..0.5] if entity @e[tag=c9_center,distance=..7.6] run summon block_display ~ ~ ~ {Tags:["c9_node","c9_tmp","c9_new"],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],translation:[-0.25f,-0.25f,-0.25f],scale:[0.5f,0.5f,0.5f]}}/execute if score #tick c9_sys matches 2..46 as @e[tag=c9_front] run tag @s remove c9_front/execute as @e[tag=c9_new] at @s run particle electric_spark ~ ~ ~ 0.1 0.1 0.1 0.05 3/execute as @e[tag=c9_new] run tag @s add c9_front/execute as @e[tag=c9_new] run tag @s remove c9_newsetup #5 Places three staggered purple stained glass barriers across the platform so a direct straight-line route is blocked.setup #9 Summons the starting emerald block display node on the left with the c9_front tag so it acts as the initial frontier of the search wave.loop #5 Checks 2 blocks to the east (+X) of every active frontier node. If the space is air, within the 7.6-block radius of the center marker, above the floor, and doesn't already contain a node, it spawns a new glowing cyan block display.loop #11 Removes the c9_front tag from the current wave of nodes after they have expanded in all six directions.loop #13 Promotes newly spawned nodes (c9_new) to the active frontier (c9_front) for the next tick and emits electric spark particles.


Recorded on our own test server: 50 frames at about 9.9 fps. Our image check saw: Glowing cyan cubes form a 3D grid expanding from a green-outlined block on the left, navigating around purple glass walls toward a glowing golden beacon on the right.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
To let players place their own obstacles or move the goal, break or build blocks anywhere inside the 15x15x15 search volume around the center marker. Because the expansion commands check if block ~ ~ ~ air in real time, the 3D search wave will automatically navigate around any new walls or ceilings you build on the next cycle.
/kill @e[tag=c9_node]/kill @e[tag=c9_goal]/kill @e[tag=c9_center]/kill @e[tag=c9_tmp]/fill ~-9 ~-1 ~-7 ~9 ~9 ~7 minecraft:air/fill ~-9 ~-1 ~-7 ~9 ~-1 ~7 minecraft:grass_block/scoreboard objectives remove c9_sys/scoreboard objectives remove c9_distUsing a 2-block lattice spacing keeps the total number of block_display entities around 110 for the entire 3D volume, ensuring smooth framerates while keeping the interior of the 3D grid easy to see.
Yes! The nodes test for air blocks at each lattice point, so you can build your own mazes out of any block and watch the cyan search wave find a way around them.
▶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