"Do it as one expression. stage is 0, 1, 2 or 3." | stage a draws trace j saved board label fixed tile row | stage := 0. a := #(1 2 3 4) copy. draws := #(2 1 2). trace := OrderedCollection with: a copy. 4 to: 2 by: -1 do: [:i | j := draws at: 5 - i. saved := a at: i. a at: i put: (a at: j). a at: j put: saved. trace add: a copy]. board := SystemWindow labelled: 'Fisher-Yates - native shrinking-range trace'. board openInWorld; position: 30@30; extent: 1000@500. label := [:text :point :size | | m | m := StringMorph contents: text font: (StrikeFont familyName: 'DejaVu Sans' pointSize: size). m color: (Color r: 0.12 g: 0.19 b: 0.29); position: board position + point. board addMorph: m]. label value: 'Choose from the active prefix. Freeze one slot.' value: 25@50 value: 24. label value: 'Scripted draws: 2 of 1..4, then 1 of 1..3, then 2 of 1..2' value: 25@95 value: 18. 0 to: stage do: [:s | row := trace at: s + 1. fixed := 4 - s. label value: ('Stage ', s printString) value: 30@(150 + (s * 65)) value: 20. 1 to: 4 do: [:k | tile := RectangleMorph new. tile position: board position + ((190 + ((k - 1) * 160))@(140 + (s * 65))); extent: 140@52. tile color: (k > fixed ifTrue: [Color r: 0.72 g: 0.93 b: 0.82] ifFalse: [Color r: 0.82 g: 0.89 b: 0.98]); borderWidth: 1; borderColor: Color gray. board addMorph: tile. label value: (row at: k) printString value: ((245 + ((k - 1) * 160))@(150 + (s * 65))) value: 24]]. label value: 'Blue: active prefix. Green: fixed positions, never touched again.' value: 25@420 value: 18. label value: (stage = 3 ifTrue: ['One active item remains. Its position is forced: the shuffle is done.'] ifFalse: ['Next draw can include the boundary itself: a self-swap is allowed.']) value: 25@455 value: 17. board