All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class busrider.Game

java.lang.Object
   |
   +----busrider.Game

public class Game
extends Object
This class represents a game of Bus-Rider.


Variable Index

 o BANK_OWNER
the player-index of the bank, -1.
 o INITIAL_CASH
The initial cash of a player, $40.
 o LARGE_FARE
the fare of a opponent-owned route, $20.
 o RIGHT_OF_WAY_COST
the cost of a Right-of-way, $60.
 o SMALL_FARE
the fare of a bank-owned route, $2.
 o WEALTHY_CASH
the amount of cash needed to be wealthy, 3/4 of WINNING_CASH.
 o WINNING_CASH
the amount of cash needed to win, $500.

Constructor Index

 o Game(String[], Object)
constructs a Game object.

Method Index

 o gameIsOver()
indicates whether the game is over.
 o getBoard()
returns the board.
 o getInstance()
returns the instance of the Game.
 o getOwner(Route)
returns the index of the player who owns the given route, or BANK_OWNER if the bank owns it.
 o getPlayers(Object)
a way for the GameApplet to view the players.
 o getPlayerView(int)
returns a view of a player.
 o getWinnerIndex()
indicates who won, if anyone.
 o main(String[])
runs the game.
 o playStep(Object)
a way for the GameApplet to advance the game one step.
 o resetGame(Object, int)
a way for the GameApplet to reset the game.

Variables

 o INITIAL_CASH
 public static final int INITIAL_CASH
The initial cash of a player, $40.

 o WINNING_CASH
 public static final int WINNING_CASH
the amount of cash needed to win, $500.

 o WEALTHY_CASH
 public static final int WEALTHY_CASH
the amount of cash needed to be wealthy, 3/4 of WINNING_CASH.

 o SMALL_FARE
 public static final int SMALL_FARE
the fare of a bank-owned route, $2.

 o LARGE_FARE
 public static final int LARGE_FARE
the fare of a opponent-owned route, $20.

 o RIGHT_OF_WAY_COST
 public static final int RIGHT_OF_WAY_COST
the cost of a Right-of-way, $60.

 o BANK_OWNER
 public static final int BANK_OWNER
the player-index of the bank, -1.

Constructors

 o Game
 public Game(String args[],
             Object key)
constructs a Game object. The first element is a string array, containing the board's URL and the strategies' class names. The second parameter is the key, which provides complete access to the game (which Strategies don't have).

Methods

 o main
 public static void main(String args[])
runs the game. Arguments are: board-file-name player-name1 player-name2...

 o getInstance
 public static Game getInstance()
returns the instance of the Game.

 o getBoard
 public Board getBoard()
returns the board.

 o getPlayerView
 public PlayerView getPlayerView(int px)
returns a view of a player. px is a player-index.

 o getOwner
 public int getOwner(Route ro)
returns the index of the player who owns the given route, or BANK_OWNER if the bank owns it.

 o playStep
 public void playStep(Object key)
a way for the GameApplet to advance the game one step.

 o gameIsOver
 public boolean gameIsOver()
indicates whether the game is over. (A Strategy gets an endGame call; this is mainly for the GameApplet.)

 o getWinnerIndex
 public int getWinnerIndex()
indicates who won, if anyone. (A Strategy gets an endGame call; this is mainly for the GameApplet.)

 o resetGame
 public void resetGame(Object key,
                       int firstTurn)
a way for the GameApplet to reset the game.

 o getPlayers
 public Player[] getPlayers(Object key)
a way for the GameApplet to view the players.


All Packages  Class Hierarchy  This Package  Previous  Next  Index