In C In this problem, you will recreate one of the truly great moments in history, namely the classic race of the tortoise and the hare. You will use random number generation to develop a simulation of this memorable event and use pointers to store / track the position of the two race contestants. Our contenders begin the race at “square 1” of 70 squares. Each square represents a possible position along the race course. The finish line is at square 70. The first contender to reach or pass square 70 is rewarded with a pail of fresh carrots and lettuce. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground. There is a clock that ticks once per second. With each tick of the clock, your program should adjust the position of the animals according to the rules shown in the table below. Implement the “race course” as an integer array containing the numbers from 1 to 70. Implement the positions of the tortoise and the hare as pointers, each pointing to the current location of the tortoise and hare. Use pointer arithmetic to change pointer locations. Think of an interesting way of showing the progress of the race on screen
In C
In this problem, you will recreate one of the truly great moments in history, namely the classic race of the tortoise and the hare. You will use random number generation to develop a simulation of this memorable event and use pointers to store / track the position of the two race contestants.
Our contenders begin the race at “square 1” of 70 squares. Each square represents a possible position along the race course. The finish line is at square 70. The first contender to reach or pass square 70 is rewarded with a pail of fresh carrots and lettuce. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground.
There is a clock that ticks once per second. With each tick of the clock, your program should adjust the position of the animals according to the rules shown in the table below.
- Implement the “race course” as an integer array containing the numbers from 1 to 70.
- Implement the positions of the tortoise and the hare as pointers, each pointing to the current location of the tortoise and hare.
- Use pointer arithmetic to change pointer locations.
Think of an interesting way of showing the progress of the race on screen
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images