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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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

Animal
Move type
Percentage of the time
Actual move
Fast plod
Slip
Slow plod
Tortoise
50%
3 squares forward
6 squares backward
1
20%
30%
square
forward
Hare
Sleep
Big hop
Big slip
Small hop
Small slip
20%
No move at all
20%
9.
squares
forward
12 squares backward
forward
10%
30%
1
square
20%
2 squares backward
Transcribed Image Text:Animal Move type Percentage of the time Actual move Fast plod Slip Slow plod Tortoise 50% 3 squares forward 6 squares backward 1 20% 30% square forward Hare Sleep Big hop Big slip Small hop Small slip 20% No move at all 20% 9. squares forward 12 squares backward forward 10% 30% 1 square 20% 2 squares backward
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education