예제 #1
0
    def __init__(self):
        self.fleet = Fleet()
        self.herd = Herd()
        self.dino_count = 0
        self.robo_count = 0
        self.fleet_health = 0
        self.herd_health = 0
        self.turn_arrow = ''
        for robo in self.fleet.robots:
            self.fleet_health += robo.health

        for dino in self.herd.dinos:
            self.herd_health += dino.health
예제 #2
0
 def run_game(self):
     fleet = Fleet()
     herd = Herd()
     player = self.display_welcome()
     team_size = user_prompt(
         "How many on each team? Less than 10 please. :", 10)
     herd.create_herd(team_size)
     fleet.create_fleet(team_size, player)
     self.fleet = fleet
     self.herd = herd
     print("\n" * 10)
     display(self.fleet, self.herd)
     input("Press enter to start the game...")
     winner = None
     game_on = True
     while game_on:
         choice = None
         print("Your turn!\n")
         if player == 1:
             choice = self.show_robo_opponent_options()
             if choice != "skip":
                 self.robo_turn(int(choice))
             # Computer Turn
             print(f"Computer's turn!\n")
             self.dino_turn(1, 2)
         else:
             choice = self.show_dino_opponent_options()
             if choice != "skip":
                 attack_type = user_prompt(
                     "What type of attack?\n1: Slam (more damage, higher energy cost)\n2: Bite\n:",
                     2)
                 self.dino_turn(int(choice), int(attack_type))
             # Computer Turn
             print(f"Computer's turn!\n")
             self.robo_turn(1)
         # Check for dead
         if self.herd.dinosaurs[0].health <= 0:
             print(f"{self.herd.dinosaurs[0].type} has died!")
             self.herd.dinosaurs.remove(self.herd.dinosaurs[0])
         if self.fleet.robots[0].health <= 0:
             print(f"{self.fleet.robots[0].name} has died!")
             self.fleet.robots.remove(self.fleet.robots[0])
         if len(self.herd.dinosaurs) < 1:
             winner = "Robots Win!"
             game_on = False
         if len(self.fleet.robots) < 1:
             winner = "Dinosaurs Win!"
             game_on = False
     self.display_winner(winner)
예제 #3
0
 def __init__(self):
     self.turn = 1
     self.user_selector = 0
     self.enemy_selector = 0
     self.target = 0
     self.fleet = Fleet()
     self.herd = Herd()
     self.user_choice = ""
     self.user = None
     self.enemy = None
     self.user_attacker = None
     self.enemy_attacked = None
     self.enemy_attacker = None
     self.user_attacked = None
     self.try_again = 0
 def fight_sequence(self):
     robotOne = Fleet()
     dinosaurOne = Herd()
     turn = 'Dinosaur'
     while not robotOne.defeated() and not dinosaurOne.defeated():
         if turn == 'Dinosaur':
             for robot in robotOne.robots:
                 robot.health -= dinosaurOne.dinosaurs[0].attack_power
             turn = 'Robot'
         elif turn == 'Robot':
             for dinosaur in dinosaurOne.dinosaurs:
                 dinosaur.health -= robotOne.robots[0].attack_power
         turn = 'Dinosaur'
     print("The dinosaurs won: ", robotOne.defeated())
     print("The robots won: ", dinosaurOne.defeated())
예제 #5
0
def battle():
    dino_player_herd = Herd()
    robot_player_fleet = Fleet()
    print(dino_player_herd)
    print(robot_player_fleet)

    def dino_turn():
        for dino in dino_player_herd.dinos:
            print(
                f'{dino.Name} has {dino.Health} health and {dino.Attack_Power} attack power'
            )
        choice = input('\nWhich dino would you like to use to attack?  ')
        for dino in dino_player_herd.dinos:
            if choice == dino.Name:
                for robot in robot_player_fleet.robots:
                    print(
                        f'{robot.Name} has {robot.Health} health and {robot.Attack_Power} attack power'
                    )
                target = input('\nWhich robot would you like to attack?  ')
                for robot in robot_player_fleet.robots:
                    if target == robot.Name:
                        robot.damage_taken(dino.Attack_Power)
                        if robot.Health < 1:
                            robot_player_fleet.robots.pop(
                                robot_player_fleet.robots.index(robot))
                            print(len(robot_player_fleet.robots))

    def robot_turn():
        for robot in robot_player_fleet.robots:
            print(
                f'{robot.Name} has {robot.Health} health and {robot.Attack_Power} attack power'
            )
        choice = input('\nWhich robot would you like to use to attack?  ')
        for robot in robot_player_fleet.robots:
            if choice == robot.Name:
                for dino in dino_player_herd.dinos:
                    print(
                        f'{dino.Name} has {dino.Health} health and {dino.Attack_Power} attack power'
                    )
                target = input('\nWhich dino would you like to attack?  ')
                for dino in dino_player_herd.dinos:
                    if target == dino.Name:
                        dino.damage_taken(robot.Attack_Power)
                        if dino.Health < 1:
                            dino_player_herd.dinos.pop(
                                dino_player_herd.dinos.index(dino))
                            print(len(dino_player_herd.dinos))

    while len(dino_player_herd.dinos) != 0 or len(
            robot_player_fleet.robots) != 0:
        dino_turn()
        robot_turn()
    if len(dino_player_herd.dinos) == 0:
        print('Congrats RoboMan, You won!')
    else:
        print('Congrats DinoMan, You won!')
예제 #6
0
    def __init__(self):
        self.fleet = Fleet()
        self.herd = Herd()

        match_over = False
        while match_over:
            if Fleet.health == 0:
                match_over = True
                del self
                print('DINOSAURS WIN!')
                print('GAME OVER')
            elif Herd.health == 0:
                match_over = True
                print('ROBOTS WIN!')
                print('GAME OVER')
                del self
예제 #7
0
def get_herd(input_xml):
    yaks_list = list()
    root_element = XMLParser.fromstring(input_xml)
    if root_element.tag != 'herd':
        raise Exception('The root element must be "herd".')
    for element in root_element.iter('labyak'):
        yak_name = element.get('name')
        if yak_name is None:
            raise Exception('The "name" is not in labyak.')

        yak_age = element.get('age')
        if yak_age is None:
            raise Exception('The "age" is not in labyak.')
        yak_age = float(yak_age) * 100

        yak_sex = element.get('sex')
        if yak_sex is None or yak_sex not in ['f', 'm']:
            raise Exception('The "sex" is not in labyak or is not m/f.')
        yak_sex = Sex.FEMALE if yak_sex == 'f' else Sex.MALE

        yaks_list.append(Yak(name=yak_name, age=yak_age, sex=yak_sex))
    if len(yaks_list) == 0:
        raise Exception('No labyak in XML file.')
    return Herd(yaks_list)
 def __init__(self):
     self.bot_fleet = Fleet()
     self.dino_herd = Herd()
     self.bot_fleet.create_robots()
     self.dino_herd.create_dinosaurs()
class Battlefield:
    def __init__(self):
        self.bot_fleet = Fleet()
        self.dino_herd = Herd()
        self.bot_fleet.create_robots()
        self.dino_herd.create_dinosaurs()

    def run_game(self):
        self.commence()
        # self.bot_fleet.show_bot_team()
        self.battle()
        self.display_winners()

    def battle(self):
        battle_active = True
        while battle_active:
            self.first_turn = True
            while self.first_turn:
                user_attack = input(
                    "\nAttack with which robot? (Type options to display attackable dinosaurs!)"
                    "\n1 = Jenny, 2 = Bipbop, 3 = Gooblium)"
                    "\n >")
                if user_attack == 'options':
                    self.show_dino_opponent_options()
                    continue
                elif user_attack == '1':
                    if self.bot_fleet.fleet[0].power_level > 0:
                        self.robot_turn(self.bot_fleet.fleet[0])
                        break
                    else:
                        print("No more power!")
                        continue
                elif user_attack == '2':
                    if self.dino_herd.herd[1].power_level > 0:
                        self.robot_turn(self.bot_fleet.fleet[1])
                        break
                    else:
                        print("No more power!")
                        continue
                elif user_attack == '3':
                    if self.bot_fleet.fleet[0].power_level > 0:
                        self.robot_turn(self.bot_fleet.fleet[2])
                        break
                    else:
                        continue
                if self.display_winners():
                    battle_active = False
                    break
                # self.first_turn = False
            self.second_turn = True
            while self.second_turn:
                user_attack = input(
                    "\nAttack with which dino? (Type options to display attackable robots!)"
                    "\n1 = Raptor, 2 = T-Rex, 3 = Stegosaurus"
                    "\n >")
                if user_attack == 'options':
                    self.bot_fleet.show_bot_team()
                    continue
                elif user_attack == '1':
                    if self.dino_herd.herd[0].energy != 0:
                        self.dino_turn(self.dino_herd.herd[0])
                    else:
                        print("This dino is all out of energy!")
                        continue
                elif user_attack == '2':
                    if self.dino_herd.herd[1].energy != 0:
                        self.dino_turn(self.dino_herd.herd[1])
                    else:
                        print("This dino is all out of energy!")
                        continue
                elif user_attack == '3':
                    if self.dino_herd.herd[2].energy != 0:
                        self.dino_turn(self.dino_herd.herd[2])
                    else:
                        print("This dino is all out of energy!")
                        continue

                if self.display_winners():
                    battle_active = False
                    break
                break

    def first_strike(self):
        user_team = input("Who goes first. Bots or Dinos? >")
        if user_team == 'bots':
            self.robot_turn(self.bot_fleet.fleet[0])
        elif user_team == 'dinos':
            self.dino_turn(self.dino_herd.herd[0])

    def display_welcome(self):
        print("Welcome to Robots VS Dinosaurs")

    def commence(self):
        print("* * * * * * * * * * * * * * * * * * * * ")
        print("---------------------------------------")
        print("               COMMENCE")
        print("---------------------------------------")
        print("* * * * * * * * * * * * * * * * * * * * ")

    def robot_turn(self, robot):
        # make this able to pick which to attack
        self.choose_dino_victim = input(
            "Choose a dino to attack! \n (1 = Raptor, 2 = T-Rex, 3 = Stegosaurus) >"
        )
        if self.choose_dino_victim == '1':
            robot.attack_dino(self.dino_herd.herd[0])
            robot.power_level -= 10
            print("\n<=======|==o__ATTACK__o==|=======>")
            print("" + robot.name + " attacks " + self.dino_herd.herd[0].type +
                  " for " + str(robot.weapon.attack_power) + "! \n" +
                  "Robot energy decreases by 10!")
            print("<=======|==o__ATTACK__o==|=======>")
            self.dino_herd.herd[0].display_dino_attributes()
        elif self.choose_dino_victim == '2':
            robot.attack_dino(self.dino_herd.herd[1])
            robot.power_level -= 10
            print("\n<=======|==o__ATTACK__o==|=======>")
            print("" + robot.name + " attacks " + self.dino_herd.herd[1].type +
                  " for " + str(robot.weapon.attack_power) + "! \n" +
                  "Robot energy decreases by 10!")
            print("<=======|==o__ATTACK__o==|=======>")
            self.dino_herd.herd[1].display_dino_attributes()
        elif self.choose_dino_victim == '3':
            robot.attack_dino(self.dino_herd.herd[2])
            robot.power_level -= 10
            print("\n<=======|==o__ATTACK__o==|=======>")
            print("" + robot.name + " attacks " + self.dino_herd.herd[2].type +
                  " for " + str(robot.weapon.attack_power) + "! \n" +
                  "Robot  energy decreases by 10!")
            print("<=======|==o__ATTACK__o==|=======>")
            self.dino_herd.herd[2].display_dino_attributes()
        else:
            self.robot_turn(robot)

    def dino_turn(self, dinosaur):
        # make robot opponent pickable
        self.choose_bot_victim = input(
            "\nAttack which bot? \n (1 = Jenny, 2 = Bipbop, 3 = Gooblium)"
            "\n >")
        if self.choose_bot_victim == '1':
            dinosaur.attack_robot(self.bot_fleet.fleet[0])
            dinosaur.energy -= 10
            print("\n<=======|==o__ATTACK__o==|=======>")
            print("" + dinosaur.type + " attacks " +
                  self.bot_fleet.fleet[0].name + " for " +
                  str(dinosaur.attack_power) + "!\n" +
                  "Her energy decreases by 10!")
            print("<=======|==o__ATTACK__o==|=======>")
            self.bot_fleet.fleet[0].display_robot_attributes()
        elif self.choose_bot_victim == '2':
            dinosaur.attack_robot(self.bot_fleet.fleet[1])
            dinosaur.energy -= 10
            print("\n<=======|==o__ATTACK__o==|=======>")
            print("" + dinosaur.type + " attacks " +
                  self.bot_fleet.fleet[0].name + " for " +
                  str(dinosaur.attack_power) + "!\n" +
                  "Her energy decreases by 10!")
            print("<=======|==o__ATTACK__o==|=======>")
            self.bot_fleet.fleet[1].display_robot_attributes()
        else:
            dinosaur.attack_robot(self.bot_fleet.fleet[2])
            dinosaur.energy -= 10
            print("\n<=======|==o__ATTACK__o==|=======>")
            print("" + dinosaur.type + " attacks " +
                  self.bot_fleet.fleet[0].name + " for " +
                  str(dinosaur.attack_power) + "!\n" +
                  "Her energy decreases by 10!")
            print("<=======|==o__ATTACK__o==|=======>")
            self.bot_fleet.fleet[2].display_robot_attributes()

    def show_dino_opponent_options(self):
        # show all dinos that are attackable
        self.dino_herd.show_dino_herd()

    def show_robot_opponent_options(self):
        # show all attackable robots
        self.bot_fleet.show_bot_team()

    def display_winners(self):
        if self.dino_herd.herd[0].health <= 0 and self.dino_herd.herd[
                1].health <= 0 and self.dino_herd.herd[2].health <= 0:
            print("\nROBOTS WIN")
            return True
        elif self.bot_fleet.fleet[0].health <= 0 and self.bot_fleet.fleet[
                1].health <= 0 and self.bot_fleet.fleet[2].health <= 0:
            print("\nDINOSAURS WIN")
            return True
        else:
            return False
예제 #10
0
from fleet import Fleet
from herd import Herd

dinosaur_herd = Herd()
robot_fleet = Fleet()


class Battlefield:

    robot_fleet.robot_fleet_health()
    dinosaur_herd.dinosaur_herd_health()
 def __init__(self):
     self.dino_herd = Herd().dinosaurs
     self.robot_fleet = Fleet().robots
     self.robot_defeated = []
     self.dinosaurs_defeated = []
예제 #12
0
from robots import Robot
from dinosaurs import Dinosaur
from fleet import Fleet
from herd import Herd
from battlefield import Battlefield

r1 = Robot('WALL-E')
r2 = Robot('T-800')
r3 = Robot('Roomba')

d1 = Dinosaur('Trogdor', 55)
d2 = Dinosaur('Allosaurus', 42)
d3 = Dinosaur('Spinosaurus', 55)

Fleet(3)
Fleet.create_fleet(r1)
Fleet.create_fleet(r2)
Fleet.create_fleet(r3)
print(Fleet.robot_fleet)

Herd(3)
Herd.create_herd(d1)
Herd.create_herd(d2)
Herd.create_herd(d3)
print(Herd.dinosaur_herd)
예제 #13
0
파일: battle.py 프로젝트: cashmy/robodino
def battle_action():
    # NOTE: THIS REALLY SHOULD BE DONE USING A DATABASE OR AN ARRAY/LIST
    #       RATHER THAN SEPARATE INSTANCES OF  ROBOTS AND DINOSAURS.
    #       AN ARRAY/LIST WOULD BE MUCH MORE EFFICIENT
    # Assemble the robots
    print('\n================================')
    robot1 = Robot('Able', 50, 50, 'Phaser').robot_attr_list()
    robot2 = Robot('Baker', 50, 50, 'Phaser').robot_attr_list()
    robot3 = Robot('Sarge', 125, 100, '').robot_attr_list()

    robot_fleet = Fleet('Armageddon')
    robot_fleet.assign_member(robot3.name, robot3.attack_power, robot3.health)
    robot_fleet.assign_member(robot1.name, robot1.attack_power, robot1.health)
    robot_fleet.assign_member(robot2.name, robot2.attack_power, robot2.health)
    robot_fleet.fleet_status()

    # Assemble the dinosaurs
    print('\n================================')
    dinosaur1 = Dinosaur('Triceratops', 75, 30, 'Bash').dino_attr_list()
    dinosaur2 = Dinosaur('Velociraptor', 50, 100, 'Tail whip').dino_attr_list()
    dinosaur3 = Dinosaur('T-Rex', 100, 70, '').dino_attr_list()

    dinosaur_herd = Herd('R-r-raw-R!')
    dinosaur_herd.add_member(dinosaur3.dino_type, dinosaur3.attack_power, dinosaur3.health)
    dinosaur_herd.add_member(dinosaur1.dino_type, dinosaur1.attack_power, dinosaur1.health)
    dinosaur_herd.add_member(dinosaur2.dino_type, dinosaur2.attack_power, dinosaur2.health)
    dinosaur_herd.herd_status()

    # Create the battle field
    water_loo = Battlefield('Water Loo')
    water_loo.side1_name = robot_fleet.name
    water_loo.side2_name = dinosaur_herd.name
    water_loo.side1_points = robot_fleet.defense_points
    water_loo.side2_points = dinosaur_herd.defense_points

    # Now fight
    battle_ended = False
    counter = 0
    engagements = len(robot_fleet.members)
    water_loo.battle_status()
    print('\n\n ***** Battle commencing *****')
    detail_print = input('Do you wish to see the details? (y/n): ')
    while not battle_ended:
        side1_damage = 0
        side2_damage = 0
        damage1 = 0
        # battle strikes happen here...
        # Individual engagements (eg. 1 vs 1, 2 vs 2, 3 vs 3)
        if (robot1.health > 0 and robot1.power_level > 0) and (dinosaur1.health > 0 and dinosaur1.energy > 0):
            robot_attack_damage = make_an_attack(robot1.attack_power)
            dino_attack_damage = make_an_attack(dinosaur1.attack_power)
            dinosaur1.update_health(robot_attack_damage).update_energy(10)
            robot1.update_health(dino_attack_damage).update_power_level(10)
            if detail_print == 'y':
                print(f'Robot {robot1.name} hits {dinosaur1.dino_type} for {robot_attack_damage} damage '
                      f'and it has {dinosaur1.health} health '
                      f'and {dinosaur1.energy} energy left.')
                print(f'The {dinosaur1.dino_type} hits {robot1.name} for {dino_attack_damage} damage '
                      f'and it has {robot1.health} health '
                      f'and {robot1.power_level} power left.\n')
            side1_damage += dino_attack_damage
            side2_damage += robot_attack_damage
        else:
            # One member has been defeated, the other may or may not be left standing.
            engagements -= 1

        if (robot2.health > 0 and robot2.power_level > 0) and (dinosaur2.health > 0 and dinosaur2.energy > 0):
            robot_attack_damage = make_an_attack(robot2.attack_power)
            dino_attack_damage = make_an_attack(dinosaur2.attack_power)
            dinosaur2.update_health(robot_attack_damage).update_energy(10)
            robot2.update_health(dino_attack_damage).update_power_level(10)
            if detail_print == 'y':
                print(f'Robot {robot2.name} hits {dinosaur2.dino_type} for {robot_attack_damage} damage '
                      f'and it has {dinosaur2.health} health '
                      f'and {dinosaur2.energy} energy left.')
                print(f'The {dinosaur2.dino_type} hits {robot2.name} for {dino_attack_damage} damage '
                      f'and it has {robot2.health} health '
                      f'and {robot2.power_level} power left.\n')
            side1_damage += dino_attack_damage
            side2_damage += robot_attack_damage
        else:
            # One member has been defeated, the other may or may not be left standing.
            engagements -= 1

        if (robot3.health > 0 and robot3.power_level > 0) and (dinosaur3.health > 0 and dinosaur3.energy > 0):
            robot_attack_damage = make_an_attack(robot3.attack_power)
            dino_attack_damage = make_an_attack(dinosaur3.attack_power)
            dinosaur3.update_health(robot_attack_damage).update_energy(10)
            robot3.update_health(dino_attack_damage).update_power_level(10)
            if detail_print == 'y':
                print(f'Robot {robot3.name} hit the {dinosaur3.dino_type} for {robot_attack_damage} damage '
                      f'and it has {dinosaur3.health} health '
                      f'and {dinosaur3.energy} energy left.')
                print(f'The {dinosaur3.dino_type} hit robot {robot3.name} for {dino_attack_damage} damage '
                      f'and it has {robot3.health} health '
                      f'and {robot3.power_level} power left.\n')
            side1_damage += dino_attack_damage
            side2_damage += robot_attack_damage
        else:
            # One member has been defeated, the other may or may not be left standing.
            engagements -= 1

        water_loo.update_battle_status(side1_damage, side2_damage)
        if detail_print == 'y':
            water_loo.battle_status()
        counter += 1
        # Check to see if either side has been wiped out or at a tactical advantage
        battle_ended = water_loo.battle_results(counter, engagements, detail_print)
        # Tactical advantage equals all engagements are complete (0).
        if engagements == 0:
            battle_ended = True
        elif counter > 15:
            # The soldiers are too wimpy and their hearts are in not in the fight!
            print('Battle has stalemated. Troops are going home.')
            battle_ended = True
예제 #14
0
class Battlefield:
    def __init__(self):
        self.fleet = Fleet()
        self.herd = Herd()
        self.dino_count = 0
        self.robo_count = 0
        self.fleet_health = 0
        self.herd_health = 0
        self.turn_arrow = ''
        for robo in self.fleet.robots:
            self.fleet_health += robo.health

        for dino in self.herd.dinos:
            self.herd_health += dino.health

    def run_game(self):
        self.fleet.create_fleet()
        self.herd.create_herd()
        self.display_welcome()
        coin = random.randint(1, 2)

        if coin == 1:
            print("Coin flip came up heads it's the Dinosaur's turn")
            self.dino_turn(self.herd.dinos[self.dino_count])

        else:
            print("Coin flip came up Tails it's the Robot's turn")
            self.robo_turn(self.fleet.robots[self.robo_count])

        while self.fleet_health > 0 and self.herd_health > 0:

            if self.turn_arrow == 'dinos':
                print(f"It is the dinosaur's turn next")
                self.dino_turn(self.herd.dinos[self.dino_count])
            else:
                print("It is the Robot's turn next")
                self.robo_turn(self.fleet.robots[self.robo_count])
        self.display_winners()

    def display_welcome(self):
        print(
            "Welcome, we will now have the opening coin flip. Dinosaurs go first on heads"
        )

    def battle(self):
        self.fleet_health = 0
        self.herd_health = 0

        for robo in self.fleet.robots:
            self.fleet_health += robo.health

        for dino in self.herd.dinos:
            self.herd_health += dino.health

    def dino_turn(self, dinosaur):
        self.show_dino_opponent_options()
        dinosaur.attack(self.fleet.robots[
            int(input("What robot number do you wish to attack")) - 1])
        if self.dino_count >= 2:
            self.dino_count = 0
        else:
            self.dino_count += 1
        self.battle()
        self.turn_arrow = "robots"

    def robo_turn(self, robot):
        self.show_robo_opponent_options()
        robot.attack(self.herd.dinos[
            int(input("What dinosaur number do you wish to attack")) - 1])
        if self.robo_count >= 2:
            self.robo_count = 0
        else:
            self.robo_count += 1
        self.battle()
        self.turn_arrow = "dinos"

    def show_dino_opponent_options(self):
        i = 0
        for robo in self.fleet.robots:
            if robo.health > 0:
                print(
                    f"Robot number {i+1} is armed with a {robo.weapon.type} and has {robo.health} remaining"
                )
            i += 1

    def show_robo_opponent_options(self):
        i = 0
        for dino in self.herd.dinos:
            if dino.health > 0:
                print(f"dinosaur number {i + 1}  has {dino.health} remaining")
            i += 1

    def display_winners(self):
        if self.fleet_health > self.herd_health:
            print("The Robots won")
        else:
            print("The Dinosaurs won")
예제 #15
0
    def initialize_battle():
        #Weapons List
        weapons = Weapons()
        #Fighters
        marvin = Robot('Marvin')
        megaman = Robot('Megaman')
        wall_E = Robot('Wall-e')
        stegosaurus = Dinosaur('Stegosaurus')
        velociraptor = Dinosaur('Velociraptor')
        tyrannosaurus = Dinosaur('Tyrannosaurus')
        #Select Weapon/Attack
        weapons.choose_weapon(marvin)
        weapons.choose_weapon(megaman)
        weapons.choose_weapon(wall_E)

        weapons.choose_attack(stegosaurus)
        weapons.choose_attack(velociraptor)
        weapons.choose_attack(tyrannosaurus)

        #Robots
        marvin.power_level = 120
        marvin.attack_power = 70

        megaman.power_level = 110
        megaman.attack_power = 100

        wall_E.power_level = 100
        wall_E.attack_power = 60

        #Dinos
        stegosaurus.attack_power = 60

        velociraptor.attack_power = 80

        tyrannosaurus.attack_power = 100

        #Fleet
        robot_fleet = Fleet()
        robot_fleet.add_to_fleet([marvin, megaman, wall_E])
        # print(robot_fleet.fleet)

        #Herd
        dino_herd = Herd()
        dino_herd.add_to_herd([stegosaurus, velociraptor, tyrannosaurus])
        # print(dino_herd.herd)

        #Display fighters and battlefield
        display(battlefield)

        # --- Fighters will attack each other randomly, last fighter standing wins!---
        def battle(fleet, herd):
            counter = 0
            for element in fleet:
                fleet_health = 0
                for i in range(0, len(element)):
                    fleet_health += element[i].health
                for obj in herd:
                    herd_health = 0
                    for a in range(0, len(obj)):
                        herd_health += obj[a].health
                    while counter <= 100 or fleet_health <= 0 or herd_health <= 0:
                        n = random.randint(0, 2)
                        i = random.randint(0, 2)
                        obj[n].attack_robo(element[n])
                        element[n].attack_dino(obj[i])
                        counter += 1

        battle(robot_fleet.fleet, dino_herd.herd)

        #Stats
        print(wall_E)
        print(megaman)
        print(marvin)
        print(stegosaurus)
        print(velociraptor)
        print(tyrannosaurus)

        def conclude_battle(robot_fleet, dino_herd):
            for element in robot_fleet.fleet:
                count = 0
                while count <= len(element):
                    for robot in element:
                        if robot.status == 'Defeated' or robot.status == 'Resting':
                            element.remove(robot)
                    count += 1

                if len(element) == 0:
                    return ctypes.windll.user32.MessageBoxW(
                        0, 'Battle concluded: Dinos have won!',
                        'Robots vs Dinosaurs', 64)

            for element in dino_herd.herd:
                count = 0
                while count <= len(element):
                    for dino in element:
                        if dino.health <= 0 or dino.status == 'Resting':
                            element.remove(dino)
                    count += 1

                if len(element) == 0:
                    return ctypes.windll.user32.MessageBoxW(
                        0, 'Battle concluded: Robos have won!',
                        'Robots vs Dinosaurs', 64)

            return ctypes.windll.user32.MessageBoxW(0, 'Battle is Ongoing!',
                                                    'Robots vs Dinosaurs', 64)

        conclude_battle(robot_fleet, dino_herd)
예제 #16
0
 def __init__(self):
     self.fleet = Fleet()
     self.herd = Herd()
     self.turn = "robot"
     self.run = False
     self.winner = ''
예제 #17
0
class Battlefield:
    def __init__(self):
        self.fleet = Fleet()
        self.herd = Herd()
        self.turn = "robot"
        self.run = False
        self.winner = ''

    def display_welcome(self):
        print()
        print()
        print("Welcome to Robots Vs Dinosaurs.")
        print()
        time.sleep(2)

        print("Here you will be given a fleet of robots.")
        print()
        time.sleep(2)

        print(
            "Your robots will pick a random weapon and you will choose which robot attacks that turn."
        )
        print()
        time.sleep(2)

        print(
            "Each attack consumes energy if your robot runs out of energy they won't be able to attack."
        )
        print()
        time.sleep(2)

        print("If your robots run out of health they die.")
        print()
        time.sleep(2)

        print("Eliminate all the dinosaurs to win.")
        print()
        time.sleep(2)

        print("Standy by initializing robots")
        print("10%")
        print()
        time.sleep(1)

        print("Standy by initializing robots")
        print("30%")
        print()
        time.sleep(1)

        print("Standy by initializing robots")
        print("60%")
        print()
        time.sleep(1)

        print("Standy by initializing robots")
        print("100%")

        print("Initialization Complete")
        print()
        time.sleep(1)

        self.fleet.create_fleet()
        self.herd.create_herd()
        print()
        start = input(
            "Your fleet is ready to deploy? Are you ready to start the battle? (y/n): "
        )
        test_start = start.lower()
        if test_start == 'y':
            self.run = True
            self.run_game()
            print("Good luck")
            print()
        else:
            print()
            print("Goodbye")

    def show_dino_options(self):
        print("Waiting for Dinosaur to attack")
        print()

    def show_robo_options(self):
        valid_for_show_robo = False
        while valid_for_show_robo == False:
            length = len(self.fleet.robots)
            if length == 3:
                print()
                selection = int(
                    input(
                        "Select which Robot is going to attack: (1, 2, or 3) : "
                    )) - 1

                if selection != 0 and selection != 1 and selection != 2:
                    print("Invalid input please try again")
                    print()
                else:
                    selected_attacker = self.fleet.robots[selection]
                    valid_for_show_robo = True
                    return selected_attacker

            elif length == 2:
                print()
                selection = int(
                    input("Select which Robot is going to attack: (1 or 2 ) : "
                          )) - 1
                print()

                if selection != 0 and selection != 1:
                    print("Invalid input please try again")
                    print()
                else:
                    selected_attacker = self.fleet.robots[selection]
                    valid_for_show_robo = True
                    return selected_attacker

            elif length == 1:
                time.sleep(2)
                selected_attacker = self.fleet.robots[0]
                valid_for_show_robo = True
                return selected_attacker

    def dino_turn(self):
        if self.turn == "dino":
            self.show_dino_options()

    def robo_turn(self):
        if self.turn == "robot":
            self.show_robo_options()

    def display_winners(self):
        if self.winner == "robot":
            print("The dinosaurs have been defeated. Robots win!!!")
        else:
            print("The Robots have been defeated. dinosaurs win!!!")

    def battle(self):
        if self.turn == 'robot':
            attacker = self.show_robo_options()
            attacker.attack(self.herd.dinosaurs[0])
            self.turn = "dino"
            print()
        else:
            self.show_dino_options()
            self.herd.dinosaurs[0].attack(self.fleet.robots[0])
            self.turn = "robot"
            print()

    def check_for_death(self):
        if self.herd.dinosaurs[0].health <= 0:
            print(self.herd.dinosaurs[0].type + " Was defeated")
            print()
            del self.herd.dinosaurs[0]

        elif self.fleet.robots[0].health <= 0:
            print(self.fleet.robots[0].name + " Was defeated")
            print()
            del self.fleet.robots[0]

    def check_for_win(self):
        if len(self.herd.dinosaurs) == 0:
            self.winner = 'robot'
            self.run = False

        elif len(self.fleet.robots) == 0:
            self.winner = 'dino'
            self.run = False

    def run_game(self):
        while self.run == True:
            self.battle()
            self.check_for_death()
            self.check_for_win()
            if self.winner != "":
                self.display_winners()
예제 #18
0
    dino_two = Dinosaur("Stegosaurus")
    dino_two.attack_power = 60
    # weapons.choose_attack(dino_two)

    dino_three = Dinosaur("Velociraptor")
    dino_three.attack_power = 85
    # weapons.choose_attack(dino_three)

    #Fleet
    robot_fleet = Fleet()
    robot_fleet.add_to_fleet([robot_megaman, robot_marvin, robot_wally])
    #print(robot_fleet.fleet)

    #Herd
    dino_herd = Herd()
    dino_herd.add_to_herd([dino_one, dino_two, dino_three])
    # print(dino_herd.herd)

    for robot in robot_fleet.fleet[0]:
        weapons.choose_weapon(robot)
    for dinosaur in dino_herd.herd[0]:
        weapons.choose_attack(dinosaur)

        #Actions
    def battle(fleet, herd):
        counter = 0
        for element in fleet:
            fleet_health = 0
            for i in range(0, len(element)):
                fleet_health += element[i].health
예제 #19
0
 def __init__(self):
     self.fleet = Fleet().robots
     self.herd = Herd().dinosaurs
예제 #20
0
from dinosaur import Dinosaur
from herd import Herd
from fleet import Fleet
from battlefield import Battlefield

star_fleet = Fleet("Star Fleet")
star_fleet.create_fleet()
the_dinos = Herd("The Dinos")
the_dinos.create_herd()
예제 #21
0
class Battlefield:
    def __init__(self):
        self.fleet = Fleet()
        self.herd = Herd()

    def display_welcome(self):
        print('Welcome to the game!')

    # The next few functions generate a game automatically, with randomly selected dinos/robots for each turn (no user control).

    def generate_teams(self):
        self.fleet.create_fleet()
        self.herd.create_herd()

        print(f'\nROBOTS:')
        i = 0
        while i < len(self.fleet.robots):
            print(f'{self.fleet.robots[i].name}')
            i += 1

        print(f'\nDINOSAURS:')
        i = 0
        while i < len(self.herd.dinosaurs):
            print(f'{self.herd.dinosaurs[i].type}')
            i += 1

    def dino_turn(self):
        dino_index = random.randint(0, len(self.herd.dinosaurs) - 1)
        robot_index = random.randint(0, len(self.fleet.robots) - 1)

        current_dino = self.herd.dinosaurs[dino_index]
        current_robot = self.fleet.robots[robot_index]

        print("\n" + Dinosaur.attack(current_dino, current_robot))

        if current_robot.health <= 0:
            print(f'{current_robot.name} health now depleted! {current_robot.name} OUT!')
            self.fleet.robots.remove(current_robot)
        else:
            print(f'{current_robot.name} health now {current_robot.health}')

        if current_dino.energy <= 0:
            print(f'{current_dino.type} energy now depleted! {current_dino.type} OUT!')
            self.herd.dinosaurs.remove(current_dino)

        else:
            print(f'{current_dino.type} energy now {current_dino.energy}')

    def robot_turn(self):
        dino_index = random.randint(0, len(self.herd.dinosaurs) - 1)
        robot_index = random.randint(0, len(self.fleet.robots) - 1)

        current_dino = self.herd.dinosaurs[dino_index]
        current_robot = self.fleet.robots[robot_index]

        print(f'\n{current_robot.name} attacks {current_dino.type} with {current_robot.weapon.type}!')

        Robot.attack(current_robot, current_dino)

        if current_dino.health <= 0:
            print(f'{current_dino.type} health now depleted! {current_dino.type} OUT!')
            self.herd.dinosaurs.remove(current_dino)
        else:
            print(f'{current_dino.type} health now {current_dino.health}')

        if current_robot.power_level <= 0:
            print(f'{current_robot.name} power level now depleted! {current_robot.name} OUT!')
            self.fleet.robots.remove(current_robot)

        else:
            print(f'{current_robot.name} power level now {current_robot.power_level}')

    def run_game(self):
        self.display_welcome()
        self.generate_teams()
        while len(self.herd.dinosaurs) > 0 and len(self.fleet.robots) > 0:
            self.dino_turn()
            if len(self.fleet.robots) > 0:
                self.robot_turn()
        if len(self.herd.dinosaurs) == 0:
            print('Robots win!')
        if len(self.fleet.robots) == 0:
            print('Dinosaurs win!')

    # These functions begin to take user input to control aspects of the game. They'll play as Team Robot.

    def user_fleet_builder(self):
        while True:
            try:
                amount_of_robots = input("How many combatants do you want on each team? Max 5 ")
                amount_of_robots = int(amount_of_robots)
                break
            except ValueError:
                print("\nOops! Enter a number from 1 to 5. ")
        if amount_of_robots > 5 or amount_of_robots <= 0:
            print('\nOops! That number was outside the available range. Your fleet has been set to 5 robots.')
            amount_of_robots = 5
        self.fleet.user_fleet(amount_of_robots)

    def team_setup(self):
        print(f'\nHere is Team Robot: ')
        i = 0
        while i < len(self.fleet.robots):
            name = self.fleet.robots[i].name
            weapon = self.fleet.robots[i].weapon.type
            attack_power = self.fleet.robots[i].weapon.attack_power
            energy_drain = self.fleet.robots[i].weapon.energy_drain
            print(f'{name}: {weapon}, attack power {attack_power}, energy drain per attack {energy_drain}')
            i += 1
        dino_amount = len(self.fleet.robots)
        # while True:
        #     try:
        #         dino_amount = input('\nHow many dinosaurs do you want to fight? ')
        #         dino_amount = int(dino_amount)
        #         break
        #     except ValueError:
        #         print('Oops! Enter the number of dinosaurs you want to fight. ')
        self.herd.create_herd_custom_amount(dino_amount)
        print('\nHere is Team Dinosaur: ')
        i = 0
        while i < len(self.herd.dinosaurs):
            name = self.herd.dinosaurs[i].type
            attack_power = self.herd.dinosaurs[i].attack_power
            energy_drain = self.herd.dinosaurs[i].energy_drain
            print(f'{name}, attack power {attack_power}, energy drain per attack {energy_drain}')
            i += 1

    def show_team_info(self):
        print(f'\nHere is Team Robot: ')
        i = 0
        while i < len(self.fleet.robots):
            name = self.fleet.robots[i].name
            weapon = self.fleet.robots[i].weapon.type
            attack_power = self.fleet.robots[i].weapon.attack_power
            health = self.fleet.robots[i].health
            power_level = self.fleet.robots[i].power_level
            energy_drain = self.fleet.robots[i].weapon.energy_drain
            print(
                f'Robot {i + 1}: {name}, {weapon}, attack power {attack_power}, health {health}, '
                f'power level {power_level}, energy drain per attack {energy_drain}')
            i += 1
        print('\nHere is Team Dinosaur: ')
        i = 0
        while i < len(self.herd.dinosaurs):
            name = self.herd.dinosaurs[i].type
            attack_power = self.herd.dinosaurs[i].attack_power
            health = self.herd.dinosaurs[i].health
            energy = self.herd.dinosaurs[i].energy
            energy_drain = self.herd.dinosaurs[i].energy_drain
            print(f'{name}: attack power {attack_power}, health {health}, energy {energy}, '
                  f'energy drain per attack {energy_drain}')
            i += 1

    def user_robot_turn(self):
        if len(self.fleet.robots) == 1:
            current_robot = self.fleet.robots[0]
        else:
            while True:
                robot_input = input('\nWhich robot do you want to use this turn? ')
                try:
                    robot_index = 6
                    i = 0
                    while i < len(self.fleet.robots):
                        if robot_input == self.fleet.robots[i].name:
                            robot_index = i
                        i += 1
                    current_robot = self.fleet.robots[robot_index]
                    break
                except IndexError:
                    print("Oops! No robots with that name. Try again... ")
        user_select = ''
        while user_select != 'attack' and user_select != 'heal':
            user_select = input(f'\nWould you like to attack a dinosaur, or heal your robot? '
                                f'Healing adds a random number of health points from 5-20 (up to max health), '
                                f'but it costs 15 power level! '
                                f'Enter "attack" or "heal" ')
            if user_select != 'attack' and user_select != 'heal':
                print(f'\nInvalid input! Try again...')
        if user_select == 'heal':
            self.user_robot_heal(current_robot)
        elif user_select == 'attack':
            self.user_robot_attack(current_robot)

    def user_robot_heal(self, robot):
        health_gain = random.randint(5, 20)
        robot.health += health_gain
        if robot.health > 100:
            print(f'{robot.name} health maxed out!')
            robot.health = 100
        else:
            print(f'\n{robot.name} gains {health_gain} health. {robot.name} health now {robot.health}!')
        robot.power_level -= 15
        if robot.power_level > 0:
            print(f'\n{robot.name} power level now {robot.power_level}!')
        elif robot.power_level <= 0:
            print(f'{robot.name} power level now depleted! {robot.name} OUT!')
            self.fleet.robots.remove(robot)

    def user_robot_attack(self, current_robot):
        if len(self.herd.dinosaurs) == 1:
            current_dino = self.herd.dinosaurs[0]
        else:
            current_dino = ''
            while current_dino == '':
                dino_name = 'Dinosaur ' + input('\nWhich dinosaur do you want to attack? Enter their Dinosaur Number: ')
                i = 0
                while i < len(self.herd.dinosaurs):
                    if self.herd.dinosaurs[i].type == dino_name:
                        current_dino = self.herd.dinosaurs[i]
                    i += 1
                if current_dino == '':
                    print(f'\nInvalid input! Try again...')

        print(f'\n{current_robot.name} attacks {current_dino.type} with {current_robot.weapon.type}!')

        Robot.attack(current_robot, current_dino)

        if current_dino.health <= 0:
            print(f'{current_dino.type} health now depleted! {current_dino.type} OUT!')
            self.herd.dinosaurs.remove(current_dino)
        else:
            print(f'{current_dino.type} health now {current_dino.health}')

        if current_robot.power_level <= 0:
            print(f'{current_robot.name} power level now depleted! {current_robot.name} OUT!')
            self.fleet.robots.remove(current_robot)

        else:
            print(f'{current_robot.name} power level now {current_robot.power_level}')

    def run_game_team_robots(self):
        print('You are Team Robot!')
        self.user_fleet_builder()
        self.team_setup()

        user_ready = 'yes'
        while len(self.herd.dinosaurs) > 0 and len(self.fleet.robots) > 0 and user_ready == 'yes':
            self.user_robot_turn()
            user_ready = input('\nReady to continue? Enter "yes" when ready ')
            while user_ready != "yes":
                user_ready = input('\nReady to continue? Enter "yes" when ready ')
            if len(self.herd.dinosaurs) > 0:
                self.dino_turn()
                if len(self.fleet.robots) > 0:
                    user_ready = input('\nReady to continue? Enter "yes" when ready ')
                    while user_ready != "yes":
                        user_ready = input('\nReady to continue? Enter "yes" when ready ')
                    self.show_team_info()

        if len(self.herd.dinosaurs) == 0:
            print('All dinosaurs depleted! Robots win!')
        if len(self.fleet.robots) == 0:
            print('All robots depleted! Dinosaurs win!')
예제 #22
0
 def __init__(self):
     self.fleet = Fleet()
     self.herd = Herd()
예제 #23
0
class Battlefield:
    def __init__(self):
        self.turn = 1
        self.user_selector = 0
        self.enemy_selector = 0
        self.target = 0
        self.fleet = Fleet()
        self.herd = Herd()
        self.user_choice = ""
        self.user = None
        self.enemy = None
        self.user_attacker = None
        self.enemy_attacked = None
        self.enemy_attacker = None
        self.user_attacked = None
        self.try_again = 0

    def run_game(self):
        self.display_welcome()
        self.fleet.create_fleet()
        self.herd.create_herd()
        self.user_choice = input('Choose "dinos" or "robots"')
        while (self.user_choice != 'dinos') and (self.user_choice != 'robots'):
            self.user_choice = input(
                'Incorrect Input: Choose "dinos" or "robots"')
        if self.user_choice == "dinos":
            self.user = self.herd.dinosaurs
            self.enemy = self.fleet.robots
            print("\nYou're team of dinos consists of:")
            for dino in self.user:
                print(
                    f'Type - {dino.type}, Energy - {dino.energy}, Power - {dino.attack_power},Health - {dino.health}'
                )
            print("\nYou're enemy robots are:")
            for robo in self.enemy:
                print(
                    f'Name - {robo.name}, Energy - {robo.power_level}, Health - {robo.health}, Weapon - {robo.weapon.type} (atk) {robo.weapon.attack_power}'
                )
        else:
            self.user = self.fleet.robots
            self.enemy = self.herd.dinosaurs
            print("\nYou're team of robots consists of:")
            for robo in self.user:
                print(
                    f'Name - {robo.name}, Energy - {robo.power_level}, Health - {robo.health}, Weapon - {robo.weapon.type} (atk) {robo.weapon.attack_power}'
                )
            print("\nYou're enemy dinosaurs are:")
            for dino in self.enemy:
                print(
                    f'Type - {dino.type}, Energy - {dino.energy}, Power - {dino.attack_power},Health - {dino.health}'
                )
        self.battle()

    def display_welcome(self):
        print("Welcome to Robots vs Dinosaurs!")

    def battle(self):
        if self.turn % 2 == 1:
            if self.user == self.herd.dinosaurs:
                self.dino_turn()
                if self.enemy_attacked.health < 1:
                    print(f"{self.enemy_attacked.name} has died!")
                    del self.enemy[self.enemy_selector]
            else:
                self.robot_turn()
                if self.enemy_attacked.health < 1:
                    print(f"{self.enemy_attacked.type} has died!")
                    del self.enemy[self.enemy_selector]
        else:
            if self.user == self.herd.dinosaurs:
                self.robot_turn()
                if self.user_attacked.health < 1:
                    print(f"{self.user_attacked.type} has died!")
                    del self.user[self.user_selector]
            else:
                self.dino_turn()
                if self.user_attacked.health < 1:
                    print(f"{self.user_attacked.name} has died!")
                    del self.user[self.user_selector]
        if len(self.user) > 0:
            if len(self.enemy) > 0:
                self.enemy_selector = 0
                self.turn += 1
                self.battle()
            else:
                print(f"You've Won! The winning team is:")
                self.display_winners()
                self.play_again()
                if self.try_again == 1:
                    self.run_game()
                else:
                    print("\n Thanks for playing Robots vs Dinosaurs!!")
        else:
            print("You've Lost... The winning team is:")
            self.display_winners()
            self.play_again()
            if self.try_again == 1:
                self.run_game()
            else:
                print("\n Thanks for playing Robots vs Dinosaurs!!")

    def dino_turn(self):
        if self.user == self.herd.dinosaurs:
            self.user_attacker = self.user[self.user_selector]
            print(
                f"\nYou're attacker is: Type - {self.user_attacker.type}, Energy - {self.user_attacker.energy}, Power - {self.user_attacker.attack_power},Health - {self.user_attacker.health}"
            )
            print(f'\nPick an enemy to attack!\n')
            self.show_robo_opponent_options()
            self.enemy_selector = int(input("Enter enemy number:"))
            while (self.enemy_selector < 0) or (self.enemy_selector >
                                                len(self.enemy) - 1):
                self.enemy_selector = int(
                    input("Incorrect Input: Please select enemy number"))
            self.enemy_attacked = self.enemy[self.enemy_selector]
            print(
                f"\n{self.user_attacker.type} attacks {self.enemy_attacked.name} for {self.user_attacker.attack_power} damage!"
            )
            self.user_attacker.attack_robot(self.enemy_attacked)
            if self.user_selector >= (len(self.user) - 1):
                self.user_selector = 0
            else:
                self.user_selector += 1
        else:
            self.target = random.randint(0, len(self.user) - 1)
            self.enemy_attacker = self.enemy[random.randint(
                0,
                len(self.enemy) - 1)]
            self.user_attacked = self.user[self.target]
            print(
                f"\n{self.enemy_attacker.type} attacks {self.user_attacked.name} for {self.enemy_attacker.attack_power} damage!"
            )
            self.enemy_attacker.attack_robot(self.user_attacked)
            if self.user_selector >= (len(self.user) - 1):
                self.user_selector = 0

    def show_robo_opponent_options(self):
        for robo in self.enemy:
            print(
                f'Enter "{self.enemy_selector}" - {robo.name}, Energy - {robo.power_level}, Health - {robo.health}, Weapon - {robo.weapon.type} (atk) {robo.weapon.attack_power}'
            )
            self.enemy_selector += 1

    def robot_turn(self):
        if self.user == self.fleet.robots:
            self.user_attacker = self.user[self.user_selector]
            print(
                f"\nYou're attacker is: Name - {self.user_attacker.name}, Energy - {self.user_attacker.power_level}, Health - {self.user_attacker.health}, Weapon - {self.user_attacker.weapon.type} (atk) {self.user_attacker.weapon.attack_power}"
            )
            print("\nPick an enemy to attack!\n")
            self.show_dino_opponent_options()
            self.enemy_selector = int(input("Enter enemy number:"))
            while (self.enemy_selector < 0) or (self.enemy_selector >
                                                len(self.enemy) - 1):
                self.enemy_selector = int(
                    input("Incorrect Input: Please select enemy number"))
            self.enemy_attacked = self.enemy[self.enemy_selector]
            print(
                f"\n{self.user_attacker.name} attacks {self.enemy_attacked.type} for {self.user_attacker.weapon.attack_power} damage!"
            )
            self.user_attacker.attack_dinosaur(self.enemy_attacked)
            if self.user_selector >= (len(self.user) - 1):
                self.user_selector = 0
            else:
                self.user_selector += 1
        else:
            self.target = random.randint(0, len(self.user) - 1)
            self.enemy_attacker = self.enemy[random.randint(
                0,
                len(self.enemy) - 1)]
            self.user_attacked = self.user[self.target]
            print(
                f"\n{self.enemy_attacker.name} attacks {self.user_attacked.type} for {self.enemy_attacker.weapon.attack_power} damage!"
            )
            self.enemy_attacker.attack_dinosaur(self.user_attacked)
            if self.user_selector >= (len(self.user) - 1):
                self.user_selector = 0

    def show_dino_opponent_options(self):
        for dino in self.enemy:
            print(
                f'Enter "{self.enemy_selector}" - {dino.type}, Energy - {dino.energy}, Health - {dino.health}, Power - {dino.attack_power}'
            )
            self.enemy_selector += 1

    def display_winners(self):
        if self.user_choice == "dinos":
            if len(self.user) == 0:
                print("The Robots!")
                for robot in self.fleet.robots:
                    print(f"Champion {robot.name}!!!")
            else:
                print("The Dinosaurs!")
                for dino in self.herd.dinosaurs:
                    print(f"Champion {dino.type}!!!")
        else:
            if len(self.user) == 0:
                print("The Dinosaurs!")
                for dino in self.herd.dinosaurs:
                    print(f"Champion {dino.type}!!!")
            else:
                print("The Robots!")
                for robot in self.fleet.robots:
                    print(f"Champion {robot.name}!!!")

    def play_again(self):
        self.try_again = input(f'Enter "1" if you want to play again!')
        if not self.try_again == "1":
            self.try_again = 0
        else:
            self.try_again = 1