MATH 170 · Clustering · Running the loop by hand

You are the algorithm claim · move · repeat

Twelve plants sit on a garden-shop bench, plotted by the sun they want and the water they drink. Three markers — the gold ×'s — start somewhere on the bench, and from there the whole method is two moves you make yourself: every plant claims the × it is nearest to, then every × walks to the balance point of the plants that claimed it. Do it again. And again. The page marks each half-step right or wrong and tells you what to look at, never what the answer is. Two things are worth finding out: it always stops, and where it stops depends on where you started it.

1 · Choose where the three ×'s start

The method never says where to begin — that part is a guess, and it is yours. Pick one of the four guesses below and press Begin the loop. When a run finishes, come back and pick a different one: the interesting question is whether the plants end up grouped the same way.

starting layout

2 · Run the loop

A pass is two half-steps and you do both. Claim: every plant goes to the × it is nearest to — all twelve, every pass, because a plant can change hands when the ×'s move. Move: each × walks to the balance point of the plants that claimed it — average their sun, average their water. Press Check my work at the end of each half-step; it will not let a wrong half-step through, and it will not tell you the answer either. Keep going until a pass asks nothing of you: that is the loop stopping, and it always does.

Claim a plant: tap it to hand it to the next ×, or Tab to it and press 1, 2 or 3 (0 takes the claim back). Move an ×: drag it, or Tab to it and use the arrow keys — one press is half a step of the grid, Shift is four. Marks: × 1 → gold filled ○ · × 2 → ink open □ · × 3 → ink filled △ (shape and fill, never colour alone). An unclaimed plant is a small hollow dot. A dashed ring means "that one is wrong"; a gold halo means "that one is right".
not started

3 · Where your runs landed

Every run you finish is written down here — which start it came from, how many passes it took, and how big the three groups ended up. Finish two runs from different starts before you decide what this bench "really" looks like.

Try: claim the two or three plants in the middle last — those are the ones that change hands between passes, and they are where the loop actually does its work.