/** * Starts a game against a human player * * @param aUser * @return id of the created game */ public synchronized int startGameAgainstHumanPlayer(User aUser) { int tempId = this.calcNumberOfGames(); Game tempGame = this.createGame(tempId, aUser.getName(), aUser.getPwd()); tempGame.setWhitePlayer(aUser); tempGame.setState(WAITING_FOR_OTHER_PLAYER); this.addGame(tempGame); return tempId; }
/** * starts a game agains a bot * * @param aUser * @return id of the game that is started */ public synchronized int startGameAgainstBot(User aUser) { int tempId = this.calcNumberOfGames(); Game tempGame = this.createGame(tempId, aUser.getName(), aUser.getPwd()); tempGame.setWhitePlayer(aUser); Bot tempBot = new Bot(); tempGame.setBlackPlayer(tempBot); tempGame.setState(STARTED); this.addGame(tempGame); return tempId; }