Today's classwork goes along with Chapter 9. We will get more practice with lists.
The following work needs to be checked off when you have completed it.
Today you will sort animals by their height. You are given some animals and some tennisballs already placed in the world. The tennis balls are evenly spaced and represent positions where the animals will stand in sorted order based on their height. The animals are standing behind the tennis balls. In this classwork, you will place the tallest animal to be positioned at the rightmost tennis ball. Then you will declare this animal and tennis ball "taken" so they will not be considered again. Next you will place the tallest animal (of those not taken yet) at the rightmost tennis ball (of those not taken yet). This is really the second tallest animal. Etc. Finally the shortest animal is to be positioned at the leftmost tennis ball.
A player is considered "taken" if it has been placed in sorted position. We will use a boolean class variable isTaken to indicate if a player is taken or not. If a player is taken, then you should not compare it with other players.
Tennis balls will be considered taken if their color is NOT yellow. A tennis ball is taken if a player has been placed in sorted order at that tennis ball. To make a tennis ball taken, you must change its color to something other than yellow, such as red.
NOTE: You may want to modify the setup method so the balls then turn their "back" to the camera, turn 180 degrees. Then "their" right is also your right when you look at them.
NOTE: A world function has been provided for you to use, isPlayerTaken returns True if the player has been taken.
NOTE: A world method "setTakenTrue" has been provided for you to set an animals isTaken value to True.
Hint: Don't use "move to" to move a player to a tennis ball or some of them will move into the ground. Instead make the player face the tennis ball and then use "move" with the distance to the tennis ball.
If you finish early, feel free to embelish your animations.