com.TeamHEC.LocomotionCommotion.Game
Class CoreGame

java.lang.Object
  extended by com.TeamHEC.LocomotionCommotion.Game.CoreGame

public class CoreGame
extends java.lang.Object

Author:
Callum Hewitt The core game object. Contains all information necessary for the backend of a single game.

Constructor Summary
CoreGame(java.lang.String Player1Name, java.lang.String Player2Name, Station Player1StationStart, Station Player2StationStart, int turnLimit)
          Initialises a Game object.
 
Method Summary
 void EndTurn()
          Ends the turn of a player.
 java.util.HashMap<java.lang.String,Resource> getBaseResources(Station station)
          Generates the resources a player will start with based on their start location
 WorldMap getGameMap()
          Gets the world map
 Player getPlayer1()
          Gets player one
 Player getPlayer2()
          Gets player two
 Player getPlayerTurn()
          Gets the player who's turn it is
 int getTurnCount()
          Gets the current turn count
 int getTurnLimit()
          Gets the turn limit for the game
 void saveGameJSON(java.lang.String gameName)
          Saves the game to a .json file in the user's home directory in a folder called LocomotionCommotion.
 void StartTurn()
          Starts a players turn.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoreGame

public CoreGame(java.lang.String Player1Name,
                java.lang.String Player2Name,
                Station Player1StationStart,
                Station Player2StationStart,
                int turnLimit)
Initialises a Game object. This represents one instance of a game.

Parameters:
Player1Name - The name of Player1
Player2Name - The name of Player2
Player1StationStart - Player1 should have selected a station to buy at the beginning of the game. This is their selected Station's object.
Player2StationStart - Player2 should have selected a station to buy at the beginning of the game. This is their selected Station's object.
turnLimit - The number of turns before the end of the game.
Method Detail

EndTurn

public void EndTurn()
Ends the turn of a player. It will increase the turn count and switch the player's turns.


StartTurn

public void StartTurn()
Starts a players turn. It will check for the end game condition.


getBaseResources

public java.util.HashMap<java.lang.String,Resource> getBaseResources(Station station)
Generates the resources a player will start with based on their start location

Parameters:
station - A player's starting location.

getGameMap

public WorldMap getGameMap()
Gets the world map

Returns:
WorldMap

getPlayer1

public Player getPlayer1()
Gets player one

Returns:
Player

getPlayer2

public Player getPlayer2()
Gets player two

Returns:
Player

getTurnCount

public int getTurnCount()
Gets the current turn count

Returns:
Int turn count

getTurnLimit

public int getTurnLimit()
Gets the turn limit for the game

Returns:
Int turn limit

getPlayerTurn

public Player getPlayerTurn()
Gets the player who's turn it is

Returns:
Player

saveGameJSON

public void saveGameJSON(java.lang.String gameName)
Saves the game to a .json file in the user's home directory in a folder called LocomotionCommotion.

Parameters:
gameName - The name of the .json file the game is saved to. (No extension).