SE2811
Software Component Design

This is an individual lab. You must work this lab without help from other students in the class. You may, however, get help from RCAS or the instructor while working this lab.

Lab 1: Making a Smarter Bee

The objective of this lab is to add an additional "GreedyBee" class to the game that implements a better strategy for accumulating points.

Assignment

Download the zipfile containing the base application. The class diagram representing this application's structure is as follows (the different colors indicate different packages):

You'll be adding your GreedyBee class in the game.characters.<yourname> package (Flower and Bee are in game.characters, while the other classes are in the game package). To help you understand the operation of the application, study the existing Bee class, particularly the planMove() method. Your GreedyBee class will be providing a completely different move-planning strategy vs. what you see there. The planMove() method is called whenever the game framework wants your GreedyBee to plan where to go during it's next turn. The framework provides a List of all other GameCharacters on the board, and you can examine them (i.e. determine their location on the board, and their current score) in formulating your move strategy. You can set any position as the target position — the Game's validateMove method will restrict the GameCharacter's motion. See the Bee class for an example implementation.

Implement a GreedyBee that moves to the nearest Flower that currently has more than 5 points. The GreedyBee should reevaluate the scenario at each time-step, and change which flower it is flying to if conditions change while it is flying. If no Flowers exists, do not move (also: ignore other Bees on the board).

To incorporate your bee into the Game, look at that class's createBees() method. You'll have to create one or more instances of your bee there. The following sequence diagram may also help you understand the entire operation of the program better:

Acknowledgement

This lab developed by Dr. Hornick.

Submission Form for Dr. Yoder