Advertisement
Matthen

Pigeon Holing

Jun 6th, 2011
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. n = 10;
  2. allocations = RandomChoice[Range[n], n + 1];
  3. endx = {};
  4. Do[
  5. endx = Append[endx,
  6. Length[Select[allocations[[i ;;]], # == allocations[[i]] &]]]
  7. , {i, n + 1}];
  8. Manipulate[ Graphics[Join[
  9. Table[{ColorData["DarkBands"][i/(n + 1)],
  10. Disk[{0, i} + t ({7 - 0.5 endx[[i]], allocations[[i]]} - {0, i}),
  11. 0.25]}, {i, 1, n + 1}],
  12. {Red, PointSize[Medium]},
  13. Table[Point[{0, i}], {i, n + 1}],
  14. {Blue},
  15. Table[Point[{7, i}], {i, n}]
  16. ], PlotRange -> {{-1, 8}, {0, n + 2}}],
  17. {t,0,1} ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement