Пример #1
0
 def applyHeuristic(self, game: Game) -> Game:
     """
         the actions taken are:
             1. place all bonus army in my city with minimum number of soldiers
             2. attack enemy city with minimum number of soldiers that can be attacked
     """
     myCities = game.citiesOf(self.isRedPlayer)
     myMinArmyCityId = self.minArmyCityId(game, myCities)
     game.placeBonusSoldiers(myMinArmyCityId,
                             game.bonusSoldiers(self.isRedPlayer))
     bestUId, bestVId = self.hisMinArmyCityToAttack(game, myCities)
     if bestUId != -1 and bestVId != -1:
         game.move(bestUId, bestVId, game.cityList[bestVId].armyCount + 1)
     return game
Пример #2
0
 def placeBonusArmy(self, army, city):
     Game.placeBonusSoldiers(city.id, army)