This is a visual demonstration of a solution to an Oxford University sort problem described by John Graham-Cumming on his blog. A robot has to sort colored balls, can only inspect each ball once, and must do something with the ball immediately after inspecting it. Enter color values below and click "Sort". Or click "Random" to generate random examples. The visualization below shows each step of the algorithm. The numbers 1,2 and 3 are pointers. The robot is only looking at the ball at pointer #2, occasionally swapping with the ball at #1 or #3. View source to see the JavaScript implementation of the algorithm.