Self-Solving Mathematical Rings (Tower of Hanoi)

Watch the classic Tower of Hanoi puzzle solve itself in Minecraft using glowing block displays, smooth interpolation, and a scoreboard timer.

Java EditionComplex Contraptions & CinematicsHard23 commandsTested on a real 26.2 & 26.3 server
Three glowing rings move across pillars on an obsidian platform to solve the Tower of Hanoi. Download the GIF Video & GIF © www.9minecraft.net

SimulationsMysticTechnologyGoldWhitePurpleLearningDecorationServer LobbyBlock displaysSmooth animation (interpolation)Riding & passengersBlock building (fill/setblock/clone)21+ commands

This command creation builds an obsidian and gold dais holding three quartz pillars and three glowing concrete rings of different sizes. Powered by a scoreboard clock and block display interpolation, the rings autonomously levitate, glide across the pillars, and stack themselves to solve the classic 3-disk Tower of Hanoi puzzle in 7 moves.

Each ring glows in the dark with a custom color outline while floating particles highlight the active movement across the stage.

1. Setup - type these once 9 commands

  1. /scoreboard objectives add c9_tick dummy
  2. /scoreboard players set #t c9_tick 0
  3. /fill ~-9 ~ ~-3 ~9 ~ ~3 crying_obsidian
  4. /fill ~-8 ~ ~-2 ~8 ~ ~2 obsidian
  5. /fill ~-6 ~ ~0 ~6 ~ ~0 gold_block
  6. /summon block_display ~ ~ ~ {Tags:["c9_obj","c9_pillars"],Passengers:[{id:"minecraft:block_display",Tags:["c9_obj"],block_state:{Name:"minecraft:quartz_pillar"},transformation:{translation:[-6.3f,1.0f,-0.3f],scale:[0.6f,4.5f,0.6f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_obj"],block_state:{Name:"minecraft:quartz_pillar"},transformation:{translation:[-0.3f,1.0f,-0.3f],scale:[0.6f,4.5f,0.6f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_obj"],block_state:{Name:"minecraft:quartz_pillar"},transformation:{translation:[5.7f,1.0f,-0.3f],scale:[0.6f,4.5f,0.6f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_obj"],block_state:{Name:"minecraft:sea_lantern"},transformation:{translation:[-6.4f,5.5f,-0.4f],scale:[0.8f,0.4f,0.8f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_obj"],block_state:{Name:"minecraft:sea_lantern"},transformation:{translation:[-0.4f,5.5f,-0.4f],scale:[0.8f,0.4f,0.8f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_obj"],block_state:{Name:"minecraft:sea_lantern"},transformation:{translation:[5.6f,5.5f,-0.4f],scale:[0.8f,0.4f,0.8f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}]}
  7. /summon block_display ~ ~ ~ {Tags:["c9_obj","c9_ring","c9_r3"],Glowing:1b,glow_color_override:16724787,interpolation_duration:7,block_state:{Name:"minecraft:magenta_concrete"},transformation:{translation:[-7.75f,1.0f,-1.75f],scale:[3.5f,0.8f,3.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  8. /summon block_display ~ ~ ~ {Tags:["c9_obj","c9_ring","c9_r2"],Glowing:1b,glow_color_override:16755200,interpolation_duration:7,block_state:{Name:"minecraft:orange_concrete"},transformation:{translation:[-7.25f,1.8f,-1.25f],scale:[2.5f,0.8f,2.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  9. /summon block_display ~ ~ ~ {Tags:["c9_obj","c9_ring","c9_r1"],Glowing:1b,glow_color_override:5636095,interpolation_duration:7,block_state:{Name:"minecraft:cyan_concrete"},transformation:{translation:[-6.85f,2.6f,-0.85f],scale:[1.7f,0.8f,1.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}

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

  1. /scoreboard players add #t c9_tick 1
  2. /execute if score #t c9_tick matches 150.. run scoreboard players set #t c9_tick 1
  3. /execute if score #t c9_tick matches 1 run data merge entity @e[tag=c9_r3,limit=1] {start_interpolation:0,transformation:{translation:[-7.75f,1.0f,-1.75f],scale:[3.5f,0.8f,3.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  4. /execute if score #t c9_tick matches 1 run data merge entity @e[tag=c9_r2,limit=1] {start_interpolation:0,transformation:{translation:[-7.25f,1.8f,-1.25f],scale:[2.5f,0.8f,2.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  5. /execute if score #t c9_tick matches 1 run data merge entity @e[tag=c9_r1,limit=1] {start_interpolation:0,transformation:{translation:[-6.85f,2.6f,-0.85f],scale:[1.7f,0.8f,1.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  6. /execute if score #t c9_tick matches 12 run data merge entity @e[tag=c9_r1,limit=1] {start_interpolation:0,transformation:{translation:[5.15f,6.2f,-0.85f],scale:[1.7f,0.8f,1.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  7. /execute if score #t c9_tick matches 20 run data merge entity @e[tag=c9_r1,limit=1] {start_interpolation:0,transformation:{translation:[5.15f,1.0f,-0.85f],scale:[1.7f,0.8f,1.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  8. /execute if score #t c9_tick matches 32 run data merge entity @e[tag=c9_r2,limit=1] {start_interpolation:0,transformation:{translation:[-1.25f,6.2f,-1.25f],scale:[2.5f,0.8f,2.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  9. /execute if score #t c9_tick matches 40 run data merge entity @e[tag=c9_r2,limit=1] {start_interpolation:0,transformation:{translation:[-1.25f,1.0f,-1.25f],scale:[2.5f,0.8f,2.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  10. /execute if score #t c9_tick matches 52 run data merge entity @e[tag=c9_r1,limit=1] {start_interpolation:0,transformation:{translation:[-0.85f,1.8f,-0.85f],scale:[1.7f,0.8f,1.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  11. /execute if score #t c9_tick matches 68 run data merge entity @e[tag=c9_r3,limit=1] {start_interpolation:0,transformation:{translation:[4.25f,1.0f,-1.75f],scale:[3.5f,0.8f,3.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  12. /execute if score #t c9_tick matches 84 run data merge entity @e[tag=c9_r1,limit=1] {start_interpolation:0,transformation:{translation:[-6.85f,1.0f,-0.85f],scale:[1.7f,0.8f,1.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  13. /execute if score #t c9_tick matches 100 run data merge entity @e[tag=c9_r2,limit=1] {start_interpolation:0,transformation:{translation:[4.75f,1.8f,-1.25f],scale:[2.5f,0.8f,2.5f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  14. /execute if score #t c9_tick matches 116 run data merge entity @e[tag=c9_r1,limit=1] {start_interpolation:0,transformation:{translation:[5.15f,2.6f,-0.85f],scale:[1.7f,0.8f,1.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}

How it works

Frames from the test run

Self-Solving Mathematical Rings (Tower of Hanoi) - frame 1Self-Solving Mathematical Rings (Tower of Hanoi) - frame 2Self-Solving Mathematical Rings (Tower of Hanoi) - frame 3

Recorded on our own test server: 67 frames at about 9.6 fps. Our image check saw: A crying obsidian and gold platform with three pillars and three differently sized glowing blocks moving between them to solve the Tower of Hanoi puzzle.

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 center of a flat open area with at least 18 blocks of clearance around you.
  2. Run each of the 9 setup commands once in chat or from impulse command blocks positioned at the stage center.
  3. Place 14 repeating command blocks (or 1 repeating command block followed by 13 chain command blocks), all set to Always Active.
  4. Paste one loop command into each block in order, making sure they execute relative to the center of the dais.
  5. Set the time to night (<code>/time set night</code>) to best see the colored glowing outlines on the moving rings.

Remove it again 3 commands

  1. /kill @e[tag=c9_obj]
  2. /fill ~-9 ~ ~-3 ~9 ~ ~3 air
  3. /scoreboard objectives remove c9_tick

FAQ

How do the rings move smoothly without teleporting in small steps?

Block displays support native client-side interpolation. By setting interpolation_duration to 7 ticks on summon and passing start_interpolation:0 whenever we merge a new translation vector, Minecraft automatically animates the transition between the two positions.

Can I change the speed of the puzzle?

Yes. Adjust the interpolation_duration value on the three ring summon commands and scale the tick numbers in the loop commands proportionally.

Commands used

/data/execute/fill/scoreboard/summon

Similar creations

Join 9Minecraft News & Guides