Question: There is a clock that ticks once per second. With each tick of the clock, your program should use function moveTortoise and moveHare to adjust

There is a clock that ticks once per second. With each tick of the clock, your program should use function moveTortoise and moveHare to adjust the position of the animals according to the rules in the table below at the end of the question. These functions should use pointer-based pass-by-reference to modify the position of the tortoise and the hare.
Use variables to keep track of the positions of the animals (i.e., position numbers are 170). Start each animal at position 1(i.e., the starting gate). If an animal slips left before square 1, move the animal back to square 1.
Generate the percentages in the preceding table by producing a random integer i in the range 1<=i <=10. For the tortoise, perform a fast plod when 1<= i <=5, a slip when 6<= i <=7 or a slow plod when 8<= i <=10. Use a similar technique to move the hare.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!