Show Your Code #4

Pick one of the following problems to do for your show your code problem. Note that these problems require different scenarios. (Dot Scenario) (Food Grab Scenario)

1. Checker Board - Using the dots scenario from the last show your code problems, add a method to the board called checkerboard. It should be called after you call either populateRandom() or populateBlue(). It should remove dots so as to make them form a checker board pattern.

2. Path Walk - For this problem you will use the FoodGrab scenario. The Lemur class in this scenario has an integer array in it called pathDir. This gives a series of numbers between 0 and 3 inclusive. These are meant to be directions with zero being up, one being right, two being down, and three being left. Make your lemur so that is it takes steps in the direction specified, in the order specified. When it runs out of numbers in the array it should start back at the beginning. (So the first time act is called you have it take a step in the direction of the first number in the array. The second time act is called you step in the direction of the second number and so on.)

3. Collecting Food - For this problem you will use the FoodGrab scenario. This scenario has a lemur, food, and a tree that the lemur calls home. Each food object has a method called getAmout() that tells you how much food is there. Make the lemur go to each food starting with the one with the largest amount and ending with the one with the smallest amount. Each time the lemur gets to a food, remove that food from the world.

4. Bring Home the Bacon - This is for people looking for a bit more of a challenge. You do #3, but with an added twist. After the Lemur picks up a food item has it walk back to its home before going to get the next food item.

5. Mouse Chase - Modify the act method of an actor so that it will chase the mouse around. The actor shouldn't move more than one square at a time. If it if on the same square as the mouse is should just sit there.