package game; import participant.Player; import java.util.ArrayList; /** * class to represent the game * * @author Rukmal Fernando * @author Hardik Kotecha * @author Radhika Srinivasan */ public class SpeckerDerivativeGame { static Administrator administrator; // administrator of game private int numRounds; // number of rounds in the game private static final String CONFIG_PATH = "config.dat"; public static void main( String[] args ) { Config.initialize( CONFIG_PATH ); new SpeckerDerivativeGame( Config.getMaxTurns() ); } /** * default constructor * * @exception RuntimeException */ public SpeckerDerivativeGame() { throw new RuntimeException( "Unable to instantiate default SpeckerDerivativeGame" ); } /** * constructor * * @param pAdministrator * @param pPlayers */ public SpeckerDerivativeGame( int pNumRounds ) { setNumRounds( pNumRounds ); ResetXml.reset(); setAdministrator( new Administrator( buildPlayers() ) ); getAdministrator().startGame( getNumRounds() ); } /** * build the Players file * * @return ArrayList */ static ArrayList buildPlayers() { ArrayList players = new ArrayList(); players.add(new Player("Fernando_Kotecha_Srinivasan", Config.getInitialMoney(), true)); return players; } /*======================================================================== | getters and setters +-----------------------------------------------------------------------*/ /** * get the game administrator * * @return Administrator */ static Administrator getAdministrator() { return administrator; } /** * set the game administrator to the given administrator * * @param pAdministrator */ static void setAdministrator( Administrator pAdministrator ) { administrator = pAdministrator; } /** * get the number of rounds * * @return int */ protected int getNumRounds() { return numRounds; } /** * set the number of rounds in the game * * @param numRounds : int */ protected void setNumRounds(int numRounds) { this.numRounds = numRounds; } /*----------------------------------------------------------------------- | end getters and setters +======================================================================*/ }