Question: This assignment requires you to code a simulation race between the tortoise and the hare. For this project, you be using random-number generation to move

This assignment requires you to code a simulation race between the tortoise and the hare. For this project, you be using random-number generation to move the creatures. To make things more interesting, the animals have to race up the side of a slippery mountain, which could cause them to lose ground. In this race either animal could win or there could be a tie with no clear winner. The animals begin at "Square 1" of 70 squares. Each of the squares represents a position the animal can hold along the racetrack. The finish line is at Square 70. When an animal wins, a winning message of your choice should be posted. For example: Yay! The rabbit won! He hops the fastest! Woo-hooo! Slow and steady wins the race! Congratulations, turtle! Tie score--no winner! Want to race again? To start the race, print a message similar to: Bang! Off they go! 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 following rules: Animal Move Type Percentage of the Time Actual Move Tortoise Fast Plod 50% 3 squares to the right Tortoise Slip 20% 6 squares to the left Tortoise Slow Plod 30% 1 squares to the right Hare Sleep 20% No move at all Hare Big Hop 20% 9 squares to the right Hare Big Slip 10% 12 squares to the left Hare Small Hop 30% 1 square to the right Hare Small Slip 20% 2 squares to the left Keep track of the positions of the animals by using variables. If an animal slips, the lowest it can go is back to position 1. The highest it can go is to position 70 when it wins the race. You will work with the percentages in the table above by generating a random integer current in the range 1

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!