|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdd.util.FishbanksSupport
Support utlities for the Fishbanks game. This is a high-level interface for interacting with the game board for the game Fishbanks. It encapsulates most of the game luck, such as scoring, boat manipulation, bank balance, and simulating the fish population.
Fishbanks is a systems-thinking game created by Dennis Meadows. It is desgined to get players to think about dynamic systems and to understand the classic "tragedy of the commons" problem. Teams play fishing companies that want to maximize their profits. Teams can buy boats, deploy them in the ocean, and catch fish. Depending on the actions of the team, the number of fish in the ocean will react accordingly, causing the fish population to grow and shrink.
Field Summary | |
static double |
CATCH_OFFSET
|
static double |
CATCH_VARIANCE
|
Fields inherited from interface dd.util.FishbanksConstants |
BOAT, COASTAL_WATERS, DEEP_OCEAN, HARBOR, LAND, TYPE |
Constructor Summary | |
FishbanksSupport()
|
Method Summary | |
static void |
addBoat(MapCell cell,
int teamNum)
Adds a boat owned by this team to the map in the cell specified. |
static void |
doOneTurn(Map map)
Do a single turn in the fishbanks game. |
static int |
getBoat(MapCell cell)
Returns the owner of the boat in the current cell. |
static int |
getBoatCount(Map map)
Returns the number of boats in the simulation. |
static int |
getBoatCount(Map map,
java.lang.String region)
Counts the number of boats in a part of the ocean. |
static int |
getBoatCount(Map map,
java.lang.String region,
int teamNum)
Counts the number of boats owned by a team in a given part of the ocean. |
static java.util.Iterator |
getBoatIterator(Map map,
java.lang.String region)
|
static java.lang.String |
getCellType(MapCell cell)
Returns the "type" of the cell. |
static int |
getExtraBoats(Map map,
int teamNum)
Returns the number of unallocated boats for a team. |
static int |
getFishCaught(Map map,
int teamNum,
java.lang.String region)
|
static int |
getNumTeams(Map map)
|
static int |
getTeamBoats(Map map,
int teamNum)
Returns the number of boats owned by a team. |
static float |
getTeamMoney(Map map,
int teamNum)
Returns the team's current bank balance |
static java.lang.String |
getTeamName(Map map,
int teamNum)
Return the descriptive name for a team. |
static boolean |
hasBoat(MapCell cell)
Returns true is the map cell contains a boat. |
static boolean |
hasBoat(MapCell cell,
int teamNum)
Returns true if the team owns a boat in this cell. |
static void |
removeBoat(MapCell cell)
Removes a boat from the map. |
static void |
setNumTeams(Map map,
int numTeams)
|
static void |
setTeamBoats(Map map,
int teamNum,
int numBoats)
Sets the number of boats owned by a team. |
static void |
setTeamMoney(Map map,
int teamNum,
float money)
Sets the team's bank balance |
static void |
setTeamName(Map map,
int teamNum,
java.lang.String teamName)
Sets the descriptive name for a team. |
static void |
startupMap(Map map,
int numTeams,
float startingBalance,
int coastalWaterFish,
int deepOceanFish)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final double CATCH_VARIANCE
public static final double CATCH_OFFSET
Constructor Detail |
public FishbanksSupport()
Method Detail |
public static void startupMap(Map map, int numTeams, float startingBalance, int coastalWaterFish, int deepOceanFish)
public static boolean hasBoat(MapCell cell)
true
.
cell
- Map cell to search for a boat
true
if the cell contains any boat,
false
otherwisepublic static boolean hasBoat(MapCell cell, int teamNum)
true
.
cell
- Map cell to search for a boatteamNum
- team who owns the boat
true
if the team owns the boat in this cell,
false
otherwise.public static int getBoat(MapCell cell)
cell
- Map cell to search for a boat
-1
if
the cell does not contain any boats.public static void addBoat(MapCell cell, int teamNum)
cell
- cell to add a boatteamNum
- the number of the team who will own the boatpublic static void removeBoat(MapCell cell)
cell
- Map cell from which the boat should be removedpublic static java.lang.String getCellType(MapCell cell)
cell
- cell whose type should be determined
FishbanksConstants
public static int getExtraBoats(Map map, int teamNum)
map
- Map to search for team boatsteamNum
- number of the team to query
public static int getBoatCount(Map map)
map
- Map to search
public static int getBoatCount(Map map, java.lang.String region)
region
is one of the constants HARBOR, COASTAL_WATERS, or
DEEP_OCEAN. This method returns the current number of boats that are
in these areas of the map.
map
- Map to search for boatsregion
- cell type to search for boats
public static java.util.Iterator getBoatIterator(Map map, java.lang.String region)
public static int getBoatCount(Map map, java.lang.String region, int teamNum)
map
- Map to search for boatsregion
- cell type to search for boatsteamNum
- number of the team that owns the boats
public static void setNumTeams(Map map, int numTeams)
public static int getNumTeams(Map map)
public static int getTeamBoats(Map map, int teamNum)
map
- Map in which this team is operatingteamNum
- number of the team to query
public static void setTeamBoats(Map map, int teamNum, int numBoats)
map
- game mapteamNum
- number of the teamnumBoats
- new number of boats for this teamremoveBoat(dd.sim.MapCell)
public static float getTeamMoney(Map map, int teamNum)
map
- game mapteamNum
- number of the team
public static void setTeamMoney(Map map, int teamNum, float money)
map
- game mapteamNum
- number of the teammoney
- new bank balance for the teampublic static java.lang.String getTeamName(Map map, int teamNum)
map
- game mapteamNum
- number of the team
public static void setTeamName(Map map, int teamNum, java.lang.String teamName)
map
- game mapteamNum
- number of the teamteamName
- new descriptive name for the teampublic static void doOneTurn(Map map)
map
- game mappublic static int getFishCaught(Map map, int teamNum, java.lang.String region)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |