>> 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 did go back and play with this some more. This version is much more
efficient and does not crash, although it does have one shortcoming.
It blindly assumes that there's enough free space to move the largest
existing file, which isn't necessarily the case. Aesthetically, it
doesn't match what I'm envisioning in my mind's eye, but it's still
kind of neat to watch for a few minutes.

http://javajack.dynalias.net/defrag/defrag014.py
(requires pygame for the visuals)

Alan

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to