[Tutor] fake defrag revisited

R. Alan Monroe amonroe at columbus.rr.com
Wed Oct 5 13:58:45 CEST 2011


> Since all the moves are swaps, it'll be guaranteed to be in a sequence 
> that converges on the correct final order.  Will it be the minimum 
> number of moves? Definitely not.  But that wasn't a requirement, and if 
> it were, you wouldn't start by building that list of tuples.

I did get a semi-working version, but it was crazy inefficient because
it regenerated the swap list after every move, and it bombed out with
a IndexError about half the time. I found that moving a single block
at a time lacked the aesthetic appeal I was hoping for, so I bagged it
for now.

I changed gears and wrote a similar program to randomize all the
pixels in a photo and then restore them one by one, by using two
shuffled arrays as large as the pixel count to swap/unswap
known-but-seemingly-random pixel pairs, but that also lacked the
aesthetic appeal I wanted.

I think to capture visual interest, the pieces would have to visibly
assemble themselves by travelling across the screen, rather that just
being painted in their final poistion. I may be biting off more than I
can chew here.

Alan



More information about the Tutor mailing list