コード例 #1
0
ファイル: RiskAI_TitanNet.cpp プロジェクト: sven001/RisikoAI
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 );
}
コード例 #2
0
ファイル: Engine.cpp プロジェクト: robert1990/COMP345_risk
void Engine::gamePlayPhase() {
    cout << "Assignment: playing the game!" << endl;
    while (victoryConditions()) {
        reinforcementPhase();
        attackPhase();
        fortificationPhase();
    }

}
コード例 #3
0
ファイル: game.c プロジェクト: linkenneth/battleship
/**
 *  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");
}