Self-Sorting Rainbow Pillars

Watch twelve scrambled rainbow pillars automatically organize themselves by height and color in 3D using a real-time bubble sort algorithm.

Java EditionComplex Contraptions & CinematicsHard24 commandsTested on a real 26.2 & 26.3 server
Twelve glowing colorful pillars of different heights sort themselves on a white platform in Minecraft. Download the GIF Video & GIF © www.9minecraft.net

SimulationsTechnologyCelebrationRainbowWhiteCyanLearningDecorationBlock displaysArmor standsSmooth animation (interpolation)Riding & passengersSummoned mobsBlock building (fill/setblock/clone)21+ commands

This command creation brings classic computer science visualization into Minecraft using glowing 3D block displays. Twelve colorful pillars of different heights spawn in a scrambled order across a quartz stage, while a glowing sea lantern pointer scans beneath them from left to right.

Each time the scanner compares two adjacent pillars that are out of order, they smoothly slide past each other and emit bright spark particles. After a few passes across the board, the pillars settle into a clean rainbow staircase before automatically scrambling themselves for another round.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_val dummy
  2. /scoreboard objectives add c9_timer dummy
  3. /fill ~-7 ~-1 ~-2 ~7 ~-1 ~2 minecraft:quartz_bricks
  4. /fill ~-6 ~-1 ~-1 ~6 ~-1 ~1 minecraft:chiseled_quartz_block
  5. /summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,NoGravity:1b,Marker:1b,Tags:["c9_all","c9_hub"],Passengers:[{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p1"],Glowing:1b,glow_color_override:16724787,teleport_duration:3,block_state:{Name:"minecraft:red_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,1.5f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p2"],Glowing:1b,glow_color_override:16744448,teleport_duration:3,block_state:{Name:"minecraft:orange_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,2.2f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p3"],Glowing:1b,glow_color_override:16766720,teleport_duration:3,block_state:{Name:"minecraft:yellow_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,2.9f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p4"],Glowing:1b,glow_color_override:8453888,teleport_duration:3,block_state:{Name:"minecraft:lime_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,3.6f,0.85f],translation:[-0.425f,0f,-0.425f]}}]}
  6. /summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,NoGravity:1b,Marker:1b,Tags:["c9_all","c9_hub"],Passengers:[{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p5"],Glowing:1b,glow_color_override:3329330,teleport_duration:3,block_state:{Name:"minecraft:green_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,4.3f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p6"],Glowing:1b,glow_color_override:5636095,teleport_duration:3,block_state:{Name:"minecraft:cyan_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,5.0f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p7"],Glowing:1b,glow_color_override:39167,teleport_duration:3,block_state:{Name:"minecraft:light_blue_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,5.7f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p8"],Glowing:1b,glow_color_override:3368703,teleport_duration:3,block_state:{Name:"minecraft:blue_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,6.4f,0.85f],translation:[-0.425f,0f,-0.425f]}}]}
  7. /summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,NoGravity:1b,Marker:1b,Tags:["c9_all","c9_hub"],Passengers:[{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p9"],Glowing:1b,glow_color_override:10040319,teleport_duration:3,block_state:{Name:"minecraft:purple_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,7.1f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p10"],Glowing:1b,glow_color_override:16711935,teleport_duration:3,block_state:{Name:"minecraft:magenta_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,7.8f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p11"],Glowing:1b,glow_color_override:16744639,teleport_duration:3,block_state:{Name:"minecraft:pink_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,8.5f,0.85f],translation:[-0.425f,0f,-0.425f]}},{id:"minecraft:block_display",Tags:["c9_all","c9_pil","c9_p12"],Glowing:1b,glow_color_override:16777215,teleport_duration:3,block_state:{Name:"minecraft:white_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.85f,9.2f,0.85f],translation:[-0.425f,0f,-0.425f]}}]}
  8. /summon minecraft:block_display ~-5.5 ~0.1 ~0.9 {Tags:["c9_all","c9_ptr"],Glowing:1b,glow_color_override:16777215,teleport_duration:2,block_state:{Name:"minecraft:sea_lantern"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.95f,0.25f,0.35f],translation:[-0.475f,0f,-0.175f]}}
  9. /execute as @e[tag=c9_pil] run ride @s dismount
  10. /kill @e[tag=c9_hub]

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

  1. /scoreboard players add #c9_t c9_timer 1
  2. /execute if score #c9_t c9_timer matches 280.. run scoreboard players set #c9_t c9_timer 1
  3. /execute if score #c9_t c9_timer matches 1 run tp @e[tag=c9_p10] ~-5.5 ~ ~
  4. /execute if score #c9_t c9_timer matches 1 run tp @e[tag=c9_p4] ~-4.5 ~ ~
  5. /execute if score #c9_t c9_timer matches 1 run tp @e[tag=c9_p12] ~-3.5 ~ ~
  6. /execute if score #c9_t c9_timer matches 1 run tp @e[tag=c9_p1] ~-2.5 ~ ~
  7. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p8] run tp @s ~-1.5 ~ ~
  8. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p3] run tp @s ~-0.5 ~ ~
  9. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p11] run tp @s ~0.5 ~ ~
  10. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p6] run tp @s ~1.5 ~ ~
  11. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p2] run tp @s ~2.5 ~ ~
  12. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p9] run tp @s ~3.5 ~ ~
  13. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p5] run tp @s ~4.5 ~ ~
  14. /execute if score #c9_t c9_timer matches 1 as @e[tag=c9_p7] run tp @s ~5.5 ~ ~

Frames from the test run

Self-Sorting Rainbow Pillars - frame 1Self-Sorting Rainbow Pillars - frame 2Self-Sorting Rainbow Pillars - frame 3

Recorded on our own test server: 70 frames at about 9.9 fps. Our image check saw: Twelve glowing colorful pillars of varying heights sit on a white platform with a glowing sea lantern pointer scanning beneath them while adjacent pillars swap positions.

Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.

Commands used

/execute/fill/kill/ride/scoreboard/summon/tp

Similar creations

Join 9Minecraft News & Guides