[Tutor] calculation issue.
eryksun
eryksun at gmail.com
Sun Aug 26 23:11:39 CEST 2012
On Sun, Aug 26, 2012 at 4:36 PM, eryksun <eryksun at gmail.com> wrote:
>
> it's 0. Once it's 0, a new pizza is created to be dropped. The
> designer wants a 30% buffer (in steps) between the time one pizza has
> finished dropping and the creation of a new pizza.
To clarify, say the chef is at y=100, and a pizza is 100 pixels high
with a speed of 2 pixels/step. check_drop() creates a new pizza and
sets time_til_drop to 1 + int(100 * 1.3 / 2) = 66. So check_drop will
be called 66 times, i.e. (65, 64, ..., 0), before another pizza gets
created. In that time the previous pizza has fallen 2 * 66 = 132
pixels, from y=100 down to y=232 (if 0,0 is the upper left-hand
corner). The bottom of the next pizza is at y = 100 + 100 = 200. That
leaves a buffer between them of 232 - 200 = 32 pixels, which is 32% in
this case.
More information about the Tutor
mailing list