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
-
BANK_OWNER
- the player-index of the bank, -1.
-
INITIAL_CASH
- The initial cash of a player, $40.
-
LARGE_FARE
- the fare of a opponent-owned route, $20.
-
RIGHT_OF_WAY_COST
- the cost of a Right-of-way, $60.
-
SMALL_FARE
- the fare of a bank-owned route, $2.
-
WEALTHY_CASH
- the amount of cash needed to be wealthy, 3/4 of WINNING_CASH.
-
WINNING_CASH
- the amount of cash needed to win, $500.
Constructor Index
-
Game(String[], Object)
- constructs a Game object.
Method Index
-
gameIsOver()
- indicates whether the game is over.
-
getBoard()
- returns the board.
-
getInstance()
- returns the instance of the Game.
-
getOwner(Route)
- returns the index of the player who owns the given route,
or BANK_OWNER if the bank owns it.
-
getPlayers(Object)
- a way for the GameApplet to view the players.
-
getPlayerView(int)
- returns a view of a player.
-
getWinnerIndex()
- indicates who won, if anyone.
-
main(String[])
- runs the game.
-
playStep(Object)
- a way for the GameApplet to advance the game one step.
-
resetGame(Object, int)
- a way for the GameApplet to reset the game.
Variables
INITIAL_CASH
public static final int INITIAL_CASH
- The initial cash of a player, $40.
WINNING_CASH
public static final int WINNING_CASH
- the amount of cash needed to win, $500.
WEALTHY_CASH
public static final int WEALTHY_CASH
- the amount of cash needed to be wealthy, 3/4 of WINNING_CASH.
SMALL_FARE
public static final int SMALL_FARE
- the fare of a bank-owned route, $2.
LARGE_FARE
public static final int LARGE_FARE
- the fare of a opponent-owned route, $20.
RIGHT_OF_WAY_COST
public static final int RIGHT_OF_WAY_COST
- the cost of a Right-of-way, $60.
BANK_OWNER
public static final int BANK_OWNER
- the player-index of the bank, -1.
Constructors
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
main
public static void main(String args[])
- runs the game.
Arguments are: board-file-name player-name1 player-name2...
getInstance
public static Game getInstance()
- returns the instance of the Game.
getBoard
public Board getBoard()
- returns the board.
getPlayerView
public PlayerView getPlayerView(int px)
- returns a view of a player.
px
is a player-index.
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.
playStep
public void playStep(Object key)
- a way for the GameApplet to advance the game one step.
gameIsOver
public boolean gameIsOver()
- indicates whether the game is over.
(A Strategy gets an
endGame
call; this is mainly for
the GameApplet.)
getWinnerIndex
public int getWinnerIndex()
- indicates who won, if anyone.
(A Strategy gets an
endGame
call; this is mainly for
the GameApplet.)
resetGame
public void resetGame(Object key,
int firstTurn)
- a way for the GameApplet to reset the game.
getPlayers
public Player[] getPlayers(Object key)
- a way for the GameApplet to view the players.
All Packages Class Hierarchy This Package Previous Next Index