def main():
    characters_list = []
    armies_list = []
    total_moral = 0
    armies_moral = np.zeros(5)
    chiefs_moral = np.zeros(5)

    with open('characters.csv') as csv_file:
        csv_reader = csv.reader(csv_file, delimiter=',')
        line_count = 0
        for line in csv_reader:
            if line_count != 0:
                new_character = Character(line[0], line[1], line[2], line[3],
                                          line[4])
                characters_list.append(new_character)
                chiefs_moral[line_count - 1] = new_character.moral_boost
            line_count += 1

    i = 0
    for character in characters_list:
        new_army = Army(character, random.uniform(20, 100))
        armies_list.append(new_army)
        army_total_moral = new_army.get_total_moral()
        print(army_total_moral)
        total_moral += army_total_moral
        armies_moral[i] = new_army.moral_base
        i += 1

    print("Moral : {}".format(total_moral))

    total_moral_numpy = np.dot(armies_moral, chiefs_moral)
    print("Moral NumPy : {}".format(total_moral_numpy))
示例#2
0
def main():
    battalion_processor = BattalionProcessor(2,
                                             horses=1,
                                             elephants=2,
                                             armoured_tanks=3,
                                             sling_guns=4)
    battalion_processor.add_battalion_substituation(BattalionType.ELEPHANTS,
                                                    BattalionType.HORSES, 2)
    battalion_processor.add_battalion_substituation(
        BattalionType.ARMOUREDTANKS, BattalionType.ELEPHANTS, 2)
    battalion_processor.add_battalion_substituation(
        BattalionType.SLINGGUNS, BattalionType.ARMOUREDTANKS, 2)
    lengaburu_army = Army(horses=100,
                          elephants=50,
                          armoured_tanks=10,
                          sling_guns=5)

    with open("input.txt", "r") as testcases:
        for testcase in testcases:
            input = [int(x.strip()) for x in testcase.split(",")]
            enemy_army = Army(horses=input[0],
                              elephants=input[1],
                              armoured_tanks=input[2],
                              sling_guns=input[3])
            planner = BattlePlanner(battalion_processor,
                                    deepcopy(lengaburu_army))
            result, army = planner.get_winning_army(enemy_army)
            display_result(input, result, army)
示例#3
0
 def test_get_battalions(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks, sling_guns=sling_guns)
     assert set(army.get_battalions()) == set([BattalionType.HORSES,
                                               BattalionType.ELEPHANTS,
                                               BattalionType.SLINGGUNS,
                                               BattalionType.ARMOUREDTANKS])
示例#4
0
    def test__correct_army_given(self):
        t1 = Army()

        # Test if a (low) valid combination of unit values is accepted
        try:
            self.assertTrue(t1._Army__correct_army_given(1, 1, 1),
                            msg="Stack test 1,1,1 failed")
        except AssertionError as e:
            self.verificationErrors.append(str(e))
示例#5
0
文件: model.py 项目: matteli/histemul
 def rally_troops(self, player, province, status):
     if province.domain_of.holder.player != player:
         return 'hidden'
     if province.manpower == 0:
         return 'disabled'
     if status == 'execute':
         Army.new(province)
         return 'done'
     return self.end_order(status)
 def test_print_standard_output_method_prints_in_the_expected_format(self):
     with patch.dict(army_data, test_army_data, clear=True):
         counter_attack = OrderedDict([('TBI', 40), ('TBII', 16)])
         self.test_army = Army('armytwo')
         self.test_army.prepare_battalions(counter_attack)
         output = WarResultOutputter(self.test_army)
         with patch('sys.stdout', new=StringIO()) as fakeOutput:
             output.print_standard_output()
             self.assertEqual(fakeOutput.getvalue().strip(),
                              'Armytwo deploys 10 TBI, 5 TBII and loses')
示例#7
0
	def come(self,player,army):
		if player == self.player:
			self army += army
		else:
			(newplayer,newarmy) = battle(self.player,Army(self.army),player,Army(army))
			self.army = newarmy
			if newplayer != self.player:
				self.buildtype = None
				self.buildtime = 0
				self.player =newplayer
示例#8
0
    def get_winning_army(self, enemy_army: Army):

        battle_result: bool = True
        for enemy_battalion in enemy_army.get_battalions():
            enemy_strength = enemy_army.get_battalion_strength(enemy_battalion)
            battle_result &= self.resolve_battalion(enemy_battalion,
                                                    enemy_strength)
        required_battalions = self.__result_army.get_all_battalion_with_strength(
        )
        return battle_result, required_battalions
示例#9
0
    def test__str__(self):
        sold = "Soldier's life = 3 and experience = 0"
        arch = "Archer's life = 3 and experience = 0"
        cav = "Cavalry's life = 4 and experience = 0"
        t1 = Army()

        # Test if the string representation of the army matches expected output for low unit values
        t1._Army__assign_army("t1", 1, 1, 1, 0)
        try:
            self.assertEqual(str(t1.force),
                             sold + "," + arch + "," + cav,
                             msg="String test 1,1,1 failed")
        except AssertionError as e:
            self.verificationErrors.append(str(e))
示例#10
0
 def test_change_battalion_strength(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks, sling_guns=sling_guns)
     army.update_battalion_strength(BattalionType.HORSES, -50)
     army.update_battalion_strength(BattalionType.SLINGGUNS, 5)
     assert army.get_battalion_strength(BattalionType.HORSES) == 50
     assert army.get_battalion_strength(BattalionType.SLINGGUNS) == 10
示例#11
0
    def test_get_winning_army_3(self):
        horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
        our_army = Army(horses=horses, elephants=elephants,
                    armoured_tanks=armoured_tanks, sling_guns=sling_guns)
        enemy_army = Army(horses=600, elephants=100)
        horses_order, elephants_order, armoured_tanks_order, sling_guns_order = 1, 2, 3, 4
        bp = BattalionProcessor(4, horses=horses_order, elephants=elephants_order,
                                armoured_tanks=armoured_tanks_order,
                                sling_guns=sling_guns_order)
        bp.add_battalion_substituation(BattalionType.ELEPHANTS, BattalionType.HORSES, 1)                        

        battle_result, winning_army = BattlePlanner(bp, deepcopy(our_army)).get_winning_army(deepcopy(enemy_army))
        assert battle_result == False
        assert winning_army == {BattalionType.HORSES: 100,
                                BattalionType.ELEPHANTS: 50}
def play_select():
	if channel_0_for_background_sound.get_volume() == 0 and sounds_volume != 0 and not music_muted:
		channel_0_for_background_sound.set_volume(sounds_volume)

	map_test = Map(box_size=20, nb_river=19, nb_mountain=35, nb_forest=61, nb_desert=35)
	points = random.randint(200, 500)
	left_army = Army(map_test, False, points, in_simulation=True)

	while run:
		for event in pygame.event.get():
			main_events(event)

		screen.fill(BLACK)
		screen.blit(background_play_select, background_play_select_rect)
		if music_muted:
			screen.blit(sound_mute, (0, 0), (-940, -40, 1024, 768))
			button("", 929, 37, 57, 57, BLACK_TRANSPARENT, "circle", unmute_music)
		else:
			screen.blit(sound_speaking, (0, 0), (-940, -40, 1024, 768))
			button("", 929, 37, 57, 57, BLACK_TRANSPARENT, "circle", mute_music)

		display_army(left_army, 290, -140)

		button("", 482, 654, 55, 55, BLACK_TRANSPARENT, "circle", menu)
		button("OPTIMIZE", 87, 225, 281, 78, RED_TRANSPARENT, "box", play_opti, action_argument={'map_test': map_test, 'left_army': left_army, 'points': points})
		button("CREATE", 87, 438, 281, 78, RED_TRANSPARENT, "box", play_create, action_argument={'map_test': map_test, 'left_army': left_army, 'points': points})

		pygame.display.update()
		clock.tick(FPS)
示例#13
0
    def special_action(self, index: int, friends_army: army.Army,
                       enemies_army: army.Army):
        to_clone = []
        s = []
        if index + 1 < len(friends_army):
            to_clone.append(friends_army[index + 1])
        if index - 1 > 0:
            to_clone.append(friends_army[index - 1])

        u: unit.Unit
        for u in to_clone:
            if u.clonable:
                friends_army.append(u.clone())
                s.append(f"{u} клонирован")

        return '\n'.join(s)
def crossover(armies, points, population, mapping):
    """
	Permet de croiser 2 parents.

	Paramètres :
		armies : liste contenant tous les objets Army (armées alliées déjà créées)
		points : entier représentant les fonds disponibles pour créer l'armée
		population : entier représentant le nombre d'armée alliée à tester pour une génération
		mapping : objet Map (from mapping import Map) représentant la carte de combat

	Return :
		armies : liste contenant les objets Army après croisement
	"""
    offspring = []
    for _ in range(int(population - len(armies))):
        parent1, parent2 = None, None
        while parent1 == parent2:
            parent1 = choice(armies)
            parent2 = choice(armies)
        army_parent1, points_used_parent1 = parent1_choice(parent1, points)
        army_parent2 = parent2_choice(parent2, points_used_parent1, parent1)
        child1 = army_parent1 + army_parent2
        offspring.append(
            Army(Map(other_map=mapping),
                 True,
                 points,
                 in_simulation=True,
                 army_base=child1))
    armies.extend(offspring)
    return armies
示例#15
0
def craete_class_from_json(file):
    armies = []
    with open(file, 'r') as f:
        data = json.load(f)

    for army in data['armies']:
        squads = []

        for squad in army['squads']:

            if squad['type'] == 'soldiers':
                units = []
                for unit in squad['units']:
                    unit = Soldier(health=unit['health'],
                                   recharge=unit['recharge'])
                    units.append(unit)
                squads.append(Squad(squad['type'], units))

            elif squad['type'] == 'vehicles':
                units = []
                for unit in squad['units']:
                    operators = []
                    for operator in unit['operators']:
                        operators.append(
                            Soldier(operator['health'], operator['recharge']))
                    units.append(
                        Vehicle(unit['health'], unit['recharge'], operators))
                squads.append(Squad(squad['type'], units))

        army = Army(army['name'], army['strategy'], squads)
        armies.append(army)
    return armies
示例#16
0
 def test_get_winning_army_1(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     our_army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks, sling_guns=sling_guns)
     enemy_army = Army(horses=200, elephants=100,
                 armoured_tanks=20, sling_guns=10)
     horses_order, elephants_order, armoured_tanks_order, sling_guns_order = 1, 2, 3, 4
     bp = BattalionProcessor(2, horses=horses_order, elephants=elephants_order,
                             armoured_tanks=armoured_tanks_order,
                             sling_guns=sling_guns_order)
                             
     battle_result, winning_army = BattlePlanner(bp, deepcopy(our_army)).get_winning_army(deepcopy(enemy_army))
     assert battle_result == True
     assert winning_army == {BattalionType.HORSES: 100,
                             BattalionType.ELEPHANTS: 50,
                             BattalionType.ARMOUREDTANKS: 10,
                             BattalionType.SLINGGUNS: 5}
示例#17
0
 def __init__(self, log_type, file=None):
     self.armies = [
         Army(army["id"], army["chosen_strategy"]) for army in armies_config
     ]
     self.battles_counter = 0
     self.report = {"introduction": "", "battles": [], "conclusion": ""}
     self.log_type = log_type
     self.file = file
示例#18
0
    def create_army(self, strat: str, count_of_soldiers_squads,
                    count_of_vehicle_squads):
        squads = list()
        for _ in range(count_of_soldiers_squads):
            squads.append(self.create_squad(Soldier, 8))
        for _ in range(count_of_vehicle_squads):
            squads.append(self.create_squad(Vehicle, 5, 3))

        return Army(strategy[strat], squads)
示例#19
0
 def test_has_battalion(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks)
     assert army.has_battalion(BattalionType.HORSES) == True
     assert army.has_battalion(BattalionType.ELEPHANTS) == True
     assert army.has_battalion(BattalionType.ARMOUREDTANKS) == True
     assert army.has_battalion(BattalionType.SLINGGUNS) == False
     assert army.has_battalion("NonExistantBattalion") == False
示例#20
0
 def get_winning_army(self, enemy_army: Army):
     """Returns the minimum required army and a bool 
     indicating the result of the battle with the returned
     army
     True : Returned army will win
     False : Returned army will lose
     Arguments:
         enemy_army {Army} -- [The army to battle against]
     Returns:
         Army -- [Minimum required army to defeat enemy_army]
         battle_result {bool} -- [boolean indicating the result of the battle]
     """
     battle_result: bool = True
     for enemy_battalion in enemy_army.get_battalions():
         enemy_strength = enemy_army.get_battalion_strength(enemy_battalion)
         battle_result &= self.resolve_battalion(enemy_battalion,
                                                 enemy_strength)
     required_battalions = self.__result_army.get_all_battalion_with_strength(
     )
     return battle_result, required_battalions
示例#21
0
 def test_resolve_with_similar_battalion(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks, sling_guns=sling_guns)
     horses, elephants, armoured_tanks, sling_guns = 1, 2, 3, 4
     bp = BattalionProcessor(horses=horses, elephants=elephants,
                             armoured_tanks=armoured_tanks,
                             sling_guns=sling_guns)
     planner = BattlePlanner(bp, army)
     assert planner.resolve_with_similar_battalion(BattalionType.HORSES, 50) == 0
     assert planner.resolve_with_similar_battalion(BattalionType.ELEPHANTS, 80) == 30
     assert planner.resolve_with_similar_battalion(BattalionType.ARMOUREDTANKS, 20) == 10
示例#22
0
    def test__correct_army_given(self):
        t1 = Army()

        # Test if a (low) valid combination of unit values is accepted
        try:
            self.assertTrue(t1._Army__correct_army_given(1, 1, 1),
                            msg="Stack test 1,1,1 failed")
        except AssertionError as e:
            self.verificationErrors.append(str(e))

        # put your __correct_army tests here
        # simple test
        try:
            self.assertEqual(t1._Army__correct_army_given(1, 1, 1),
                             True,
                             msg="correct_army method failed")
        except AssertionError as e:
            self.verificationErrors.append(str(e))

        # Testing for negative inputs
        try:
            self.assertEqual(t1._Army__correct_army_given(-1, -1, 1),
                             False,
                             msg="correct_army method failed")
        except AssertionError as e:
            self.verificationErrors.append(str(e))

        # testing for over the budget inputs
        try:
            self.assertEqual(t1._Army__correct_army_given(21, 41, 1),
                             False,
                             msg="correct_army method failed")
        except AssertionError as e:
            self.verificationErrors.append(str(e))
示例#23
0
    def gladiatorial_combat(self, player_one: str, player_two: str) -> int:
        """ This method reads and creates an army for each player, say army1
            and army1, sets them in stack formation

        @complexity: Best O(n) and worst O(n)
        """
        FORMATION = 0  # constant
        army_1 = Army()  # creating an instance of Army
        army_1.choose_army(player_one, FORMATION)  # creating player stack

        army_2 = Army()  # creating an instance of Army
        army_2.choose_army(player_two, FORMATION)  # creating player stack

        return self.__conduct_combat(army_1, army_2, FORMATION)
示例#24
0
    def __init__(self):
        self.unit_obj = Units()
        self.army_obj = Army()

        self.MENU = [
            [
                'Create squad', lambda: self.interact(
                    [['Create squad', lambda: self.unit_obj.create_unit()],
                     ['List squad', lambda: self.print_data('units_list')],
                     ['Back', lambda: 'exit']])
            ],
            [
                'Rules', lambda: self.interact([[
                    'Create rules', lambda: self.unit_obj.create_rules()
                ], ['List rules', lambda: self.print_data('rules_list')],
                                                ['Back', lambda: 'exit']])
            ],
            ['Create user Army', lambda: self.army_obj.create_army()],
            ['Play', lambda: self.army_obj.battle()],
            ['Set default', lambda: self.clear_data()],
            ['Exit', lambda: 'exit'],
        ]
示例#25
0
 def test_army_init(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks, sling_guns=sling_guns)
     assert army.get_battalion_strength(BattalionType.HORSES) == horses
     assert army.get_battalion_strength(BattalionType.ELEPHANTS) == elephants
     assert army.get_battalion_strength(BattalionType.ARMOUREDTANKS) == armoured_tanks
     assert army.get_battalion_strength(BattalionType.SLINGGUNS) == sling_guns
示例#26
0
    def fairer_combat(self, player_one: str, player_two: str) -> int:
        """ Conducts a battle between two armies in queue formation and  whenever a
        fighter survives, it gets appended at the end of the queue and at the end it
        return the winner from the conduct_combat method

        @complexity: Best O(n) and worst O(n)
        """
        FORMATION = 1
        army_1 = Army()  # creating an instance of Army
        army_1.choose_army(player_one, FORMATION)  # creating player stack

        army_2 = Army()  # creating an instance of Army
        army_2.choose_army(player_two, FORMATION)  # creating player stack

        return self.__conduct_combat(army_1, army_2, FORMATION)
示例#27
0
 def test_resolve_battalion_3(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     our_army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks, sling_guns=sling_guns)
     horses, elephants, armoured_tanks, sling_guns = 1, 2, 3, 4
     bp = BattalionProcessor(3, horses=horses, elephants=elephants,
                             armoured_tanks=armoured_tanks,
                             sling_guns=sling_guns)
     bp.add_battalion_substituation(BattalionType.ELEPHANTS, BattalionType.HORSES, 2)                                
     bp.add_battalion_substituation(BattalionType.ARMOUREDTANKS, BattalionType.HORSES, 4)
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 30) == True
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 104) == True
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 105) == True
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 106) == False
def init_simu(population, in_simulation, mapping, points):
    """
	Permet de créer les premières armées.

	Paramètres :
		population : entier représentant le nombre d'armée alliée à tester pour une génération
		in_simulation : booléen (False si c'est pas une simulation, True si s'en est une)
		mapping : objet Map (from mapping import Map) représentant la carte de combat
		points : entier représentant les fonds disponibles pour créer l'armée
	"""
    return [
        Army(Map(other_map=mapping), True, points, in_simulation=in_simulation)
        for _ in range(population)
    ]
示例#29
0
 def test_resolve_battalion_4(self):
     horses, elephants, armoured_tanks, sling_guns = 100, 50, 10, 5
     our_army = Army(horses=horses, elephants=elephants,
                 armoured_tanks=armoured_tanks, sling_guns=sling_guns)
     horses, elephants, armoured_tanks, sling_guns = 1, 2, 3, 4
     bp = BattalionProcessor(3, horses=horses, elephants=elephants,
                             armoured_tanks=armoured_tanks,
                             sling_guns=sling_guns)
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 29) == True
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 30) == True
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 31) == False
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 104) == False
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 105) == False
     assert BattlePlanner(bp, deepcopy(our_army)).resolve_battalion(BattalionType.ARMOUREDTANKS, 106) == False        
示例#30
0
    def test___conduct_combat(self):
        t1 = Army()
        t2 = Army()
        battle = Battle()
        formation = 0

        # Test if combat is conducted correctly and returns appropriate result for empty p1 army and all Archer p2 army
        # Assumes __assign_army is working correctly
        t1._Army__assign_army("", 0, 0, 0, formation)
        t2._Army__assign_army("", 0, 10, 0, formation)
        try:
            self.assertTrue(
                battle._Battle__conduct_combat(t1, t2, formation) == 2,
                "Gladiatorial 0,0,0 0,10,0 failed")
        except AssertionError as e:
            self.verificationErrors.append(str(e))
示例#31
0
    def gladiatorial_combat(self, player_one: str, player_two: str) -> int:
        '''Sets up two players and creates their desired enemies. Returns the value of the victor. 
        Only uses Stack ADT formation. 
        
        0 - Draw
        1 - Player 1 wins
        2 - Player 2 wins
        :complexity: Best O(1) occurs when the __conduct_combat method returns the winner, due to one army having no fighters.
        Worst O(Army*Life), where Army represents the length of the army with the smallest number of fighters and Life 
        represents the life of each figher, and this occurs when the __conduct_combat method iterates through the entire armies.
        '''
        p1 = Army()
        p1.choose_army(str(player_one), 0)
        p2 = Army()
        p2.choose_army(str(player_two), 0)

        return self.__conduct_combat(p1, p2, 0)
示例#32
0
 def aggressors(self):
     from army import Army
     return Army.objects(Q(battle=self) & Q(attitude='aggressor'))
示例#33
0
 def armies(self):
     #from army import Army
     return Army.objects(for_the=self)
示例#34
0
 def army(self):
     #from army import Army
     return Army.objects(origin=self).first()
示例#35
0
 def armies(self, armies=None, select_related=1):
     if not armies:
         from army import Army
         return Army.objects(location=self).select_related(select_related)
     return armies.filter(location=self)
示例#36
0
 def armies(self):
     from army import Army
     return Army.objects(battle=self)
示例#37
0
文件: model.py 项目: matteli/histemul
    def __init__(self, reset=False, preset=False):
        self.model = {
            'army': Army,
            'battle': Battle,
            'culture': Culture,
            'land': Land,
            'person': Person,
            'player': Player,
            'province': Province,
            'title': Title,
            'war': War,
        }
        connect('histemul')
        self.orders = {}

        if reset:
            client = MongoClient()
            db = client.histemul
            Player.drop_collection()
            Person.drop_collection()
            Army.drop_collection()
            Battle.drop_collection()
            War.drop_collection()

            Province.drop_collection()
            #collection = db.province_vo
            db.command('aggregate', 'province_vo', pipeline=[{'$match':{}}, {'$out': "province"}], allowDiskUse=True, cursor={})
            if preset:
                Matthieu = self.new_player('Matthieu', division='fess', tinctures=['green', 'orange'])
                Pierre = self.new_player('Pierre', division='pale', tinctures=['blue', 'red'])
                Robert = self.new_person('Robert', True, datetime.date(975, 1, 1), Matthieu, 1)
                Jean = self.new_person('Jean', True, datetime.date(981, 1, 1), Pierre, 14)
                Philippe = self.new_person('Philippe', True, datetime.date(965, 1, 1), Pierre, 39)
                Matthieu.leader = Robert
                Matthieu.save()
                Pierre.leader = Jean
                Pierre.save()

                Berquinais = Title.objects.get(pk='Berquinais')
                Berquinais.holder = Robert
                Berquinais.name_number = {'Robert': 1}
                Berquinais.save()

                Orvence = Title.objects.get(pk='Orvence')
                Orvence.holder = Jean
                Orvence.name_number = {'Jean': 1}
                Orvence.save()

                Bourquige = Title.objects.get(pk='Bourquige')
                Bourquige.holder = Philippe
                Bourquige.name_number = {'Philippe': 1}
                Bourquige.save()

                Berquinais_province = Province.objects.get(name='Berquinais')
                Berquinais_province.controller = Robert
                Berquinais_province.save()

                Orvence_province = Province.objects.get(name='Orvence')
                Orvence_province.controller = Jean
                Orvence_province.save()

                Bourquige_province = Province.objects.get(name='Bourquige')
                Bourquige_province.controller = Philippe
                Bourquige_province.save()

                Army_Orvence = self.rally_troops(Pierre, Orvence_province, 'execute')
示例#38
0
 def defenders(self):
     from army import Army
     return Army.objects(Q(battle=self) & Q(attitude='defender'))