bool RiskAI_TitanNet::yourTurn( GAMEPHASE phase ) { if( eval == NULL ) { eval = new RiskMapEvaluator( map ); } switch( phase ) { case ADD_ARMYS: { eval->evaluateTempVal( player->getPlayerId() ); addArmyPhase(); } break; case ATTACK: { attackPhase(); } break; case MOVE: { movePhase(); } break; } return( true ); }
void Engine::gamePlayPhase() { cout << "Assignment: playing the game!" << endl; while (victoryConditions()) { reinforcementPhase(); attackPhase(); fortificationPhase(); } }
/** * Starts the game. A game consists of two phases: a 'placing' phase and a * 'attacking' phase. In the 'placing' phase, players take turns to place * their ships on the board. After the 'placing' phase is over, the * 'attacking' phase begins, in which players take turns guessing and * attacking where they think the opponent's ship is. The first player to * win is to one to sink all of their opponent's ships. NUM refers to the * number of AI players. O for both human players. Will display a msg. */ void start(int num) { Player *p1, *p2; if (num != 0) { printf("%d AI player created. \n", num); if (num == 1) { printf("Human player goes first!\n"); p1 = newHumanPlayer(); p2 = newComputerPlayer(); } else { p1 = newComputerPlayer(); p2 = newComputerPlayer(); } } else { printf("Two human players selected! GLHF!\n"); } GameState gameStates[2]; gameStates[0].player = p1; gameStates[1].player = p2; gameStates[0].ships = (Ship *) malloc(sizeof(Ship) * NUM_SHIPS); gameStates[1].ships = (Ship *) malloc(sizeof(Ship) * NUM_SHIPS); placePhase(gameStates); attackPhase(gameStates, NUM_SHIPS); printf("GAME OVER LOLOLOLO\n"); }