POV-Ray : Newsgroups : povray.text.scene-files : Weird Loop Behavior : Re: Weird Loop Behavior Server Time
9 Dec 2023 19:06:46 EST (-0500)
  Re: Weird Loop Behavior  
From: Dave Blandston
Date: 14 Jul 2022 16:25:00
Message: <web.62d07953a05c0a6df2f053ba607c1b34@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> ideally that code/macro would take two args - the number of prisoners/boxes, and
> the number of chains (and perhaps dictate their lengths too?).  (have a feeling
> this code can find other uses :-))

If I understand correctly, a chain that's too long can be split into two chains
by altering only two slips. I'm guessing that it would be just as easy to
combine two chains into one. So what you're suggesting is very possible.

I was so intrigued by the riddle that I thought it would be fun to conduct a
successful simulated exercise with one million prisoners. It looks like that
will take about three weeks using POV-Ray so I probably won't do that after all.
But I think the array of randomly numbered slips could be analyzed quickly to
determine the longest chain and therefore if the actual exercise would succeed.

If anyone is interested, here's a version with a much quicker slip randomization
algorithm. That part was a lot of fun too because it depends on balancing two
slow operations (moving large numbers of array elements around versus randomly
picking array elements that haven't already been picked) and the balance point
turned out to be much different than I thought it would be.

Kind regards,
Dave Blandston

Post a reply to this message

Download 'riddle3.pov.dat' (6 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.