POV-Ray : Newsgroups : povray.text.scene-files : Weird Loop Behavior : Weird Loop Behavior Server Time
9 Dec 2023 19:59:12 EST (-0500)
  Weird Loop Behavior  
From: Dave Blandston
Date: 11 Jul 2022 17:00:00
Message: <web.62cc8f0fef6482234907a549607c1b34@news.povray.org>
Greetings Friends,

This video https://www.youtube.com/watch?v=iSNsgj1OCLA introduces an algorithm
that's easy to write and I found it intriguing. SDL might not be ideal for this
sort of thing (relatively slow) but it's all I have set up for use at the moment
so that's what I used. It's not necessary to watch the video to see what's going
on with the POV code, by the way.

There are two issues with this code. One might be a bug in POV-Ray, and the
other is probably a feature but it doesn't work the way that would make sense to
me. (Disclaimer: I'm an amateur so there's probably a reason that it works the
way that it does that I'm not aware of.)

Issue number one, possible POV bug: When I run the attached file with version
3.7, the final result that's displayed is 80% success rate. This is not an
anticipated result. However, un-commenting the line "#local Dummy = 0;" changes
the final result to 50% success rate, which appears to be correct. The variable
"Dummy" is never used and should have no effect on anything.

Issue number two, #break directive behavior: Without the #if () test marked with
the comment "//Why is this test necessary?" the #break directive will exit not
only the #for (K...) loop, but also the #for (J...) loop if the #break directive
is executed on the last iteration of the #for (K...) loop. When that happens,
the remainder of the #for (J...) loop is not completed as it should be (or as I
think it should be, anyway).

I'm mentioning these issues in case they might persist into version 3.8...

Have a wonderful day folks!

Kind regards,
Dave Blandston

Post a reply to this message

Download 'riddle.pov.dat' (2 KB)

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