Jeep Sheep!

Game designers are designing characters for a new online game they hope is going to go viral - Jeep Sheep!

3 sheep race their jeeps 1000m. The first jeep to reach the finish line is the winner. Before the race starts, the player predicts which sheep will win. If the prediction is correct, the player wins!

They need a coder to code the game logic of the game. Harold, the initial designer has already made a start:

#create an empty array to store the three racers' names

#ask the player for the name of each racer and append into the array

#now set up another array to store the distance travelled for each racer, starting at 0:

#now get the prediction from the player:

#Now validate the user input. The user must enter only one of the available names

#start of game logic. Play the game while no racer has reached 1000

#generate a random number between 0 and 100 for each racer and update each racer's distance (hint: use a for loop)

#inside the loop you could also print out each racers' current disctance travelled... print(f"")

#Is there anything else that needs to go inside the game loop?

#If not, it means someone has won! Write some code to determine which index in the racers array stores the biggest value.

#Use the index to grab the winning sheep's name and compare it to the player's prediciton. Did the player win?!

Adaptation

Do you have any ideas to make this code more interesting?

The game must remain the same:

  1. There are 3 sheeps in jeeps.
  2. There is 1 human player.
  3. The sheep race 1000m.
  4. The player predicts the winner.
  5. The result is displayed.

However, we can adapt this game and make it more fun and/or unpredictable and/or outrageous etc.

For example, perhaps a sheep crashes along the way and is unable to finish... along with a dramatic message which is displayed... or has to call for help and gets a distance penalty of -100m

Or, you could use time.sleep() in the game loop... and maybe print out some --- to represent how each sheep is doing during the race... eg:

Jack ----

Joe --

Jill -----

Or... if two jeeps bump, they both miss a turn to move forward and a dramatic message is displayed...

Or.........

Testing

Make sure you are thoughtful when testing your solution.

If your code has a validation check, test your code with acceptable/valid data and unacceptable/invalid data.