Professional Documents
Culture Documents
Name
Period
Details
Methods
move
//harvest pair 1
harvestCorner*,
move
harvestCorner,
move
harvestCorner,
move
harvestCorner,
move
harvestCorner
turnLeft, move,
turnLeft
See above
turnRight**, move
turnRight
Repeat for pairs 2
and 3
Move forward
When done, turn of
1) move()
2) harvestTwoRows()
a) harvestOneRow()
b) goToNextRow()
c) harvestOneRow()
3) positionForNextHarvest()
4) move ()
5) turnof()
Notes:
* harvestCorner is only pickBeeper(). By creating a method, the program can
be easily modified in the future if a field with two or more beepers at each
corner needs to be harvested.
**turnRight() is turnLeft() 3 times
New methods within larger methods are private, but making them public
would work here, too. When a program has more than one class, public
methods can be used by other classes. Private methods can be used only
within their class.
Constructor
New Methods
Modifications
1. Create new worlds:
a. harvestLongerRows: Place more than 5 beepers in each row.
b. harvestMoreRows: Add more rows of beepersbe sure to have an even number of
rows.
c. harvestMoreBeepers: Add more beepers to each corner. Be sure each corner has
the same number of beepers.
d. No world, just add this:World.setSize (15,15) (or whatever size you want). Instead
of harvesting beepers, plant them.
2. Copy your projects (one for each world)
3. Modify your methods and main methods to accommodate the new worlds.