CSC 15 Lab 5 Reminder: Important Linux commands. When running programs that draw graphics, please do not move the window while the program is running. If all goes well the program should stop when the mydraw function finishes. But sometimes you may want to stop it in the middle. For this, the best thing to do is the following: At the terminal prompt where you ran the program, type Control-Z. You'll see a message such as [5]+ Stopped python bounce.py This program is now a zombie. A zombie is a program that should be dead but is not. You need to kill it with the following command: kill -9 %5 The "5" needs to match the number in the message above. Don't leave zombies around. At the command prompt, type the word "jobs". This shows all the programs at their current status are were started from the terminal window. You can kill them with the same command. ------------- 1. Make sure you have ready the function that returns the INDEX of the largest number in an array, and return -1 if there's a tie for the largest. You can put that in a file called "myfuns.py", then insert the following line at the top of programs that need to use it: from myfuns import * 2. Horse Race Simulation This is the main part of the lab, and requires you to complete a horse race simulation. You'll need to use the largest-index function from class. Download "hroutline.py" which contains an outline program, and modify the "mydraw" function. You'll need to use an array to represent the x coordinates of each horse. The number of horses in the race MUST be variable. The program needs to contain a NESTED while loop. The outer loop controls animation, and stops when some horse crosess the finish line. The inner loop needs to iterate through the array of horses and increment the x position of each horse by a random value, as well as draw each horse on the screen. You then need to determine which horse is in the lead and print a message to screen using the drawtext function I've given you. Follow the notes and examples in the outline program. The finished product should look similar to the professor's sample program. The following elements are required in particular: A. Your program needs to work for any number of horses. Use a variable to define the number of horses in the race. The program should work for any number of horses. B. You need to draw lines to separate the horses between "tracks". You also need to draw the finish line. ----------------- Options. The following could be done for extra credit 1. name the horses. Try to use the "command line argument array" sys.argv. First put "from sys import *" at the top of the program. When you start a python program, you can start using a command such as $ python horserace abc def ghi Inside the program, sys.argv[0]=="horserace", sys.argv[1]=="abc", etc.. Thus you can name the horses, as well as determine how many horses are going to be in the race when you start the program. 2. Find a background image, and instead of using a solid green rectangle, construct a more interesting background for the race 3. Use different animated gifs for each racer.