Discussion:
A4Q3 clarifications
(too old to reply)
Sang-gon
2011-07-07 06:21:19 UTC
Permalink
Hello,
Can I have clarifications for question 3:

1. For countdown() in Potato class, it's written that it returns true
if timer's gone off and false otherwise. Is it supposed to reduce the
potato's ticks by 1 as well, or not, or it's up to me?

2. When seed is given as input, is it applied across the whole program
or it's only for when the potato's timer is set initially by umpire in
Set 1?

3. The "toss" function in Player class, by name of it it sounds like
just a single toss from one player to another. But assignment says it
returns id of player eliminated. I'm confused which one's right
because if it's exactly what assignment is saying, I have no idea how
to record the sequence of players that got potato. Or can I print out
output while the toss function gets run?

4. It says there are 3 calls to random number generator. Does calling
another function that calls PRNG count as one of 3 too?

Thanks!
Terry Anderson
2011-07-07 22:46:49 UTC
Permalink
Post by Sang-gon
1. For countdown() in Potato class, it's written that it returns true
if timer's gone off and false otherwise. Is it supposed to reduce the
potato's ticks by 1 as well, or not, or it's up to me?
Yes, this is clearly stated in the assignment description.
Post by Sang-gon
2. When seed is given as input, is it applied across the whole program
or it's only for when the potato's timer is set initially by umpire in
Set 1?
It is applied across the whole program.
Post by Sang-gon
3. The "toss" function in Player class, by name of it it sounds like
just a single toss from one player to another. But assignment says it
returns id of player eliminated. I'm confused which one's right
because if it's exactly what assignment is saying, I have no idea how
to record the sequence of players that got potato. Or can I print out
output while the toss function gets run?
They are both right. Think of this function being called recursively,
with the base case being the time when the potato's timer goes off.
Post by Sang-gon
4. It says there are 3 calls to random number generator. Does calling
another function that calls PRNG count as one of 3 too?
The three calls you need to make in order to generate random values are
clearly stated at the bottom of page 5.

Terry

Continue reading on narkive:
Loading...