Re: [Tutor] fake defrag revisited

2011-10-09 Thread R. Alan Monroe
>> 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 >> fo

Re: [Tutor] fake defrag revisited

2011-10-05 Thread Wayne Werner
On Wed, Oct 5, 2011 at 8:18 AM, Dave Angel wrote: > Anyway, you can slow it down drastically by alternating bubble passes with > random passes, where in each case a random pair is swapped if they're out of > order. > You can also slow it down by adding a time.sleep(1) (sleeps for 1 second). Use

Re: [Tutor] fake defrag revisited

2011-10-05 Thread Dave Angel
On 10/05/2011 07:58 AM, R. Alan Monroe wrote: 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 t

Re: [Tutor] fake defrag revisited

2011-10-05 Thread R. Alan Monroe
> 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 sem

Re: [Tutor] fake defrag revisited

2011-10-04 Thread Dave Angel
On 10/01/2011 03:53 PM, R. Alan Monroe wrote: You missed the rest of the paragraph. Don't wait for the sort to finish, you do the swapping in the compare function. Either I'm too dumb to understand your answer, or explained my original problem too poorly. Have you ever played the Rush Hour

Re: [Tutor] fake defrag revisited

2011-10-01 Thread Dave Angel
On 10/01/2011 11:53 AM, R. Alan Monroe wrote: achieve the cosmetic randomness, until I realized the real problem is magically determining the correct sequence in which to perform the moves without ruining a future move inadverently. If I move 0-to-1 first, I've now ruined the future 1-to-22 whic

Re: [Tutor] fake defrag revisited

2011-10-01 Thread R. Alan Monroe
>> achieve the cosmetic randomness, until I realized the real problem is >> magically determining the correct sequence in which to perform the >> moves without ruining a future move inadverently. >> >> If I move 0-to-1 first, I've now ruined the future 1-to-22 which ought >> to have taken place in

Re: [Tutor] fake defrag revisited

2011-10-01 Thread Dave Angel
On 10/01/2011 02:06 AM, R. Alan Monroe wrote: I'm revisiting the fake defrag program I posted about a few months ago. The concept is basically a screensaver or light show where you can enjoy watching entropy being reversed as colored blocks order themselves visually. I set it aside for a while b

[Tutor] fake defrag revisited

2011-09-30 Thread R. Alan Monroe
I'm revisiting the fake defrag program I posted about a few months ago. The concept is basically a screensaver or light show where you can enjoy watching entropy being reversed as colored blocks order themselves visually. I set it aside for a while because it was too slow, but I finally came up wi