Interface IBeastBrain

All Known Implementing Classes:
DumbBrain, RandomWalkingBrain

public interface IBeastBrain

A beast's brain, capable of choosing a direction to go next and a mood to assume next based on its own information (e.g., current direction, location, and mood) and information about its pack.

Author:
CPSC 111 instructors

Method Summary
 Direction chooseDirection(BeastInfo me, IPackFinder packFinder)
          Choose the next direction for this beast.
 BeastMood chooseMood(BeastInfo me, IPackFinder packFinder)
          Choose the next mood for this beast.
 

Method Detail

chooseMood

BeastMood chooseMood(BeastInfo me,
                     IPackFinder packFinder)
Choose the next mood for this beast.

Note: there's no guarantee that each time this method is called, the brain's beast will then assume the chosen mood next. For example, this call could just be another brain querying this brain about what IT would do in this situation.

The moral of this information is that if you need to know something about the state of the beast, you should try to get it from the BeastInfo parameter. (For example, you can determine the beast's age from the BeastInfo parameter. That's a great way to figure out a mood that gets better with time!)

Parameters:
me - information about this beast (what its brain knows about its body/state), must be non-null
packFinder - a pack finder to tell this beast about its pack (must be non-null)
Returns:
a chosen mood to assume next, non-null

chooseDirection

Direction chooseDirection(BeastInfo me,
                          IPackFinder packFinder)
Choose the next direction for this beast.

Note: there's no guarantee that each time this method is called, the brain's beast will then assume the chosen direction next. For example, this call could just be another brain querying this brain about what IT would do in this situation.

The moral of this information is that if you need to know something about the state of the beast, you should try to get it from the BeastInfo parameter. (For example, you can determine the beast's age from the BeastInfo parameter. That's a great way to figure out a direction that will send the beast in circles!

Parameters:
me - information about this beast (what its brain knows about its body/state), must be non-null
packFinder - a pack finder to tell this beast about its pack (must be non-null)
Returns:
a chosen direction to go next (non-null)