Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Task 3 Compare Results (part 1)
#11
(08-30-2017, 01:13 AM)davidmccoy Wrote: These are whatever, use Scott's below for better tests.

Make the following bash script test3.sh:
Code:
#!/bin/bash
echo "(0.0 0.0 100)" > task3.args
scam -r task3.scm task3.args > results.text
echo "(-1 10 250)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(22 22 500)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(-9 -9 0)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(0.001 -0.00432 1)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(0.001 -0.00432 100)" > task3.args
scam -r task3.scm task3.args >> results.text
Run 
Code:
chmod u+x test3.sh
./test3.sh
Compare your results.text with my output:
Code:
100 0 0 0
1 255 3 2
1 255 2 1
0 0 0 0
1 0 0 0
100 0 0
This is very late, but I'm pretty sure the test cases (-1 10 250), (22 22 500), and (-9 -9 0) should all return 0 since they diverge immediately.

Although, I'm not sure if we should just output 0 and stop, or pass the 0 into the color functions and output the correct values.
Reply
#12
(09-09-2017, 09:26 AM)nebrinda Wrote: This is very late, but I'm pretty sure the test cases (-1 10 250), (22 22 500), and (-9 -9 0) should all return 0 since they diverge immediately.

Although, I'm not sure if we should just output 0 and stop, or pass the 0 into the color functions and output the correct values.

You just saved my butt, nice catch (guess I'm using the grace period for grace after all)!

You should pass 0 and t into the color functions and output the correct values.
UA ACM Vice President
ACM has bi-weekly meetings Tuesdays at 5:15pm
We're UA's best organization for CS majors (website)
Join us on Slack for all kinds of discussion channels (including one for CS403)
Reply
#13
(09-09-2017, 03:38 PM)davidmccoy Wrote:
(09-09-2017, 09:26 AM)nebrinda Wrote: This is very late, but I'm pretty sure the test cases (-1 10 250), (22 22 500), and (-9 -9 0) should all return 0 since they diverge immediately.

Although, I'm not sure if we should just output 0 and stop, or pass the 0 into the color functions and output the correct values.

You just saved my butt, nice catch (guess I'm using the grace period for grace after all)!

You should pass 0 and t into the color functions and output the correct values.

Happy to help! Just for sanity's sake, I get the following output for those cases:


0 255 0 0
0 255 0 0
0 0 0 0
Reply
#14
(09-09-2017, 09:26 AM)nebrinda Wrote: This is very late, but I'm pretty sure the test cases (-1 10 250), (22 22 500), and (-9 -9 0) should all return 0 since they diverge immediately.

Although, I'm not sure if we should just output 0 and stop, or pass the 0 into the color functions and output the correct values.

I think this depends on whether we test (r,s)=(0,0) or not.
A person could argue that (r,s) = (0,0) should not be tested because it would always fail the divergence test.
However, that means that we should start with (r,s) = (x,y).
If this is the case, then what's the point of the spec saying that (r,s) should start out at (0,0)?
Can the programmer overrule the spec in favor of efficiency?
I'm not sure what to do...Hopefully, Dr. Lusth can weigh-in before the grace period deadline...

edit: I guess the statement that (r,s) should start at (0,0) is more of an informative statement rather than a specification, but I'd still like a confirmation.
Reply
#15
(09-09-2017, 06:40 PM)james_h Wrote:
(09-09-2017, 09:26 AM)nebrinda Wrote: This is very late, but I'm pretty sure the test cases (-1 10 250), (22 22 500), and (-9 -9 0) should all return 0 since they diverge immediately.

Although, I'm not sure if we should just output 0 and stop, or pass the 0 into the color functions and output the correct values.

I think this depends on whether we test (r,s)=(0,0) or not.
A person could argue that (r,s) = (0,0) should not be tested because it would always fail the divergence test.
However, that means that we should start with (r,s) = (x,y).
If this is the case, then what's the point of the spec saying that (r,s) should start out at (0,0)?
Can the programmer overrule the spec in favor of efficiency?
I'm not sure what to do...Hopefully, Dr. Lusth can weigh-in before the grace period deadline...
That's a very good point, I hadn't considered that. 
Seems like the point of it startings at 0,0 is so that it depends on the x and y values only, and to not consider r and s in our initial check for divergence.
Reply
#16
(09-09-2017, 06:47 PM)nebrinda Wrote: That's a very good point, I hadn't considered that. 
Seems like the point of it startings at 0,0 is so that it depends on the x and y values only, and to not consider r and s in our initial check for divergence.

Right, I'm saying that if that was the case, why not just say (r,s) start at (x,y)?

To add to the confusion, Dr. Lusth's results on the first page of this thread shows that his initial values for (r,s) is (0,0).
Reply
#17
(09-09-2017, 07:09 PM)james_h Wrote:
(09-09-2017, 06:47 PM)nebrinda Wrote: That's a very good point, I hadn't considered that. 
Seems like the point of it startings at 0,0 is so that it depends on the x and y values only, and to not consider r and s in our initial check for divergence.

Right, I'm saying that if that was the case, why not just say (r,s) start at (x,y)?

To add to the confusion, Dr. Lusth's results on the first page of this thread shows that his initial values for (r,s) is (0,0).

Oh lord, now I have no idea what the correct start values are.
Reply
#18
(09-09-2017, 07:20 PM)nebrinda Wrote: Oh lord, now I have no idea what the correct start values are.

More confusion:

If the initial values of (r,s) are (x,y), then we have:
i = -1 corresponds to (r,s) = (0,0)               (even if not computed)
i =  0 corresponds to (r,s) = (x,y)
...
How horrendous is a sequence that counts starting from -1?

On the other hand, if the initial values of (r,s) are (0,0), then the function mred can only return 255 when the threshold is 0 because the number of iterations can never equal 0 otherwise.
It's a color function that cannot return it's full range for threshold t > 0...

edit:
I'm going with letting the initial values of (r,s) = (x,y) because it seems more sensible. In any case, I think the spec is sufficiently ambiguous enough that one could argue either way, so the fault should lie in the specification rather than the programmer.
Reply
#19
Based on the results, it appears that (r,s) = (0,0) is the case being described when the assignment says "returning 0 if the divergence test is immediately true" which is a little counter-intuitive as it will never return true, thus the equation will never return 0...
Reply
#20
I am still having trouble reading data from the main and calling the functions individually, appreciate any pointer..use car, cdr? how to capture the result from resistance in the main? Thank you
WINTER IS COMING Exclamation
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)