예제 #1
0
 def _fortify_ranking(self, source: Territory, destination: Territory):
     return (source.bordering_enemies() *
             self._weights['frt_bordering_enemies'] +
             source.vantage() * self._weights['frt_army_vantage'] +
             source.number_of_connections *
             self._weights['frt_a_number_of_connections'] +
             destination.number_of_connections *
             self._weights['frt_d_number_of_connections'] +
             source.armies * self._weights['frt_a_size'] +
             destination.armies * self._weights['frt_d_size'])
예제 #2
0
    def test_bordering_enemies(self):
        first_player = Player()
        second_player = Player()

        t1 = Territory()
        t2 = Territory()
        t3 = Territory()

        t1.owner = first_player
        t2.owner = first_player
        t3.owner = second_player

        t2.reinforce(1)
        t3.reinforce(2)

        t1.connect(t2)
        t1.connect(t3)

        self.assertEqual(3, t1.bordering_enemies())