Live Pathfinding Visualizer

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.

Java EditionComplex Contraptions & CinematicsHard24 commandsTested on a real 26.2 & 26.3 server
Glowing cyan and purple tiles visualize a pathfinding search algorithm moving through a dark Minecraft maze. Download the GIF Video & GIF © www.9minecraft.net

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.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_timer dummy
  2. /fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:obsidian
  3. /fill ~-9 ~ ~-9 ~9 ~1 ~9 minecraft:deepslate_bricks
  4. /fill ~-7 ~ ~-7 ~7 ~1 ~7 minecraft:air
  5. /fill ~-5 ~ ~-7 ~-3 ~1 ~3 minecraft:deepslate_bricks
  6. /fill ~-1 ~ ~-3 ~1 ~1 ~7 minecraft:deepslate_bricks
  7. /fill ~3 ~ ~-7 ~5 ~1 ~3 minecraft:deepslate_bricks
  8. /setblock ~-7 ~-1 ~-7 minecraft:emerald_block
  9. /setblock ~7 ~-1 ~7 minecraft:amethyst_block
  10. /summon minecraft:marker ~ ~ ~ {Tags:["c9_ctrl","c9_sim"]}

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

  1. /execute as @e[type=minecraft:marker,tag=c9_ctrl] run scoreboard players add @s c9_timer 1
  2. /execute as @e[type=minecraft:marker,tag=c9_ctrl,scores={c9_timer=1}] at @s run kill @e[tag=c9_sim,tag=!c9_ctrl]
  3. /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]}}
  4. /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]}}
  5. /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
  6. /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]}}
  7. /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]}}
  8. /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]}}
  9. /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]}}
  10. /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]}}
  11. /execute as @e[tag=c9_node,tag=!c9_path] at @s if block ~ ~-1 ~ minecraft:amethyst_block run tag @s add c9_path
  12. /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
  13. /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]}}
  14. /execute as @e[type=minecraft:marker,tag=c9_ctrl,scores={c9_timer=110..}] run scoreboard players set @s c9_timer 0

How it works

Frames from the test run

Live Pathfinding Visualizer - frame 1Live Pathfinding Visualizer - frame 2Live Pathfinding Visualizer - frame 3

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.

Build it in your world

  1. Stand in the middle of a flat open area with at least 10 blocks of clearance in every direction.
  2. Run the 10 setup commands in chat or paste them into impulse command blocks to construct the obsidian and deepslate brick maze.
  3. Place 14 repeating command blocks (or 1 repeating followed by 13 chain command blocks), all set to Always Active.
  4. Paste the 14 loop commands in order into the command blocks.
  5. Watch the cyan search wave flood the corridors, turn purple after exploring, and illuminate the golden path to the magenta crystal before looping automatically.

Use it with real players

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.

Remove it again 4 commands

  1. /kill @e[tag=c9_sim]
  2. /scoreboard objectives remove c9_timer
  3. /fill ~-9 ~-1 ~-9 ~9 ~1 ~9 minecraft:air
  4. /fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 minecraft:grass_block

FAQ

Can I reshape the maze walls?

Yes! 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.

Why does the node spacing jump by 2 blocks?

Stepping by 2 blocks keeps the total number of block_display entities under 60 for the entire 19x19 arena, ensuring smooth performance without lag.

Commands used

/data/execute/fill/kill/scoreboard/setblock/summon/tag

Similar creations

Join 9Minecraft News & Guides