Exemplo n.º 1
0
def run_battle(player_modules,
               speed=150,
               asteroids_count=50,
               drones_count=5,
               show_screen=False):
    scene = SpaceField(
        speed=speed,
        field=(1200, 1200),
        asteroids_count=asteroids_count,
        can_fight=True,
        headless=not show_screen,
    )
    scene._Scene__teams = OrderedDict()
    drones_teams = {}
    drones_paths = {}
    for i, team_module in enumerate(player_modules):
        module_to_import = team_module.replace('.py',
                                               '').replace('/', '.').replace(
                                                   '\\', '.')
        drone_module = importlib.import_module(module_to_import)
        if not hasattr(drone_module, 'drone_class'):
            raise ValueError(
                f'In module {team_module} no variable drone_class: cant import drones!!!'
            )
        drone = drone_module.drone_class
        drones_paths[drone.__name__] = team_module
        drones_teams[i] = [drone() for _ in range(drones_count)]
    battle_result = scene.go()
    battle_result['players_modules'] = drones_paths
    return battle_result
Exemplo n.º 2
0
 def setUp(self):
     self.scene = SpaceField(theme_mod_path='tests.themes.for_cargo_box')
     self.initial_cargo = 50
     self.maximum_cargo = 100
     self.half_load_speed = theme.CARGO_TRANSITION_SPEED // 2
     self.unit1 = CargoBoxVehicle(coord=Point(0, 0),
                                  payload=self.initial_cargo,
                                  max_payload=self.maximum_cargo)
     self.unit2 = CargoBoxVehicle(coord=Point(0, 0),
                                  payload=self.initial_cargo,
                                  max_payload=self.maximum_cargo)
Exemplo n.º 3
0
# -*- coding: utf-8 -*-

# pip install -r requirements.txt

from astrobox.space_field import SpaceField
from stage_03_harvesters.reaper import ReaperDrone
# TODO тут импортировать своих дронов
from vader import VaderDrone

NUMBER_OF_DRONES = 5

if __name__ == '__main__':
    scene = SpaceField(
        speed=5,
        asteroids_count=20,
    )
    # TODO создать их
    team_1 = [VaderDrone() for _ in range(NUMBER_OF_DRONES)]
    # TODO и побороть противников!
    team_2 = [ReaperDrone() for _ in range(NUMBER_OF_DRONES)]
    scene.go()

Exemplo n.º 4
0
# -*- coding: utf-8 -*-

from astrobox.space_field import SpaceField
from KhizhovDrone import KhizhovDrone
from stage_03_harvesters.reaper import ReaperDrone
from stage_03_harvesters.driller import DrillerDrone
from stage_03_harvesters.vader import VaderDrone
DRONE_COUNT = 5

if __name__ == '__main__':
    scene = SpaceField(
        field=(1000, 900),
        speed=3,
        asteroids_count=10,
        can_fight=False,
    )
    my_team = []
    enemy_team = []
    my_drones = [KhizhovDrone() for i in range(DRONE_COUNT)]
    for drone in my_drones:
        my_team.append(drone)
    enemy_drones = [DrillerDrone() for i in range(DRONE_COUNT)]
    # enemy_drones2 = [ReaperDrone() for i in range(DRONE_COUNT)]
    # enemy_drones3 = [VaderDrone() for i in range(DRONE_COUNT)]

    scene.go()
    my_drones[0].game_over()

#  на Windows 1.3.0 Теперь не вылетаетет,выдает GameOver при завешении игры, а мою статистику не выдает.
#  Процесс не завершается
#  А на убунту всё норм, выдает GameOver и при закрытии окна выдает мою статистику
Exemplo n.º 5
0
# -*- coding: utf-8 -*-

# pip install -r requirements.txt

from astrobox.space_field import SpaceField

from zaboev import ZaboevDrone

if __name__ == '__main__':
    scene = SpaceField(
        speed=3,
        asteroids_count=10,
    )

    for drone in range(5):
        d = ZaboevDrone()

    scene.go()

# Второй этап: зачёт!
Exemplo n.º 6
0
# -*- coding: utf-8 -*-

# pip install -r requirements.txt
from astrobox.space_field import SpaceField
from python_base_diploma.kireev import UrikDrone


if __name__ == '__main__':
    scene = SpaceField(speed=4,
                       asteroids_count=10,
                       can_fight=True
                       )
    d = UrikDrone()
    d.my_team = [UrikDrone() for _ in range(4)]

    scene.go()
Exemplo n.º 7
0
from astrobox.space_field import SpaceField
from stage_03_harvesters.driller import DrillerDrone
from stage_03_harvesters.reaper import ReaperDrone
from devastator import DevastatorDrone
from surkova import SurkovaDrone

NUMBER_OF_DRONES = 5


class Dev2(DevastatorDrone):
    pass


class Dev3(DevastatorDrone):
    pass


if __name__ == '__main__':
    scene = SpaceField(
        field=(1200, 600),
        speed=3,
        asteroids_count=15,
        can_fight=True,
    )
    team_1 = [SurkovaDrone() for _ in range(NUMBER_OF_DRONES)]
    team_2 = [Dev3() for _ in range(NUMBER_OF_DRONES)]
    # team_3 = [Dev2() for _ in range(NUMBER_OF_DRONES)]
    team_4 = [DevastatorDrone() for _ in range(NUMBER_OF_DRONES)]

    scene.go()
Exemplo n.º 8
0
# -*- coding: utf-8 -*-

# pip install -r requirements.txt

from astrobox.space_field import SpaceField
from stage_03_harvesters.driller import DrillerDrone
from stage_03_harvesters.reaper import ReaperDrone
from stage_04_soldiers.devastator import DevastatorDrone
from kochetov import KochetovDrone
from vader import VaderDrone

NUMBER_OF_DRONES = 5

if __name__ == '__main__':
    scene = SpaceField(
        field=(1200, 900),
        speed=10,
        asteroids_count=17,
        can_fight=True,
    )
    # team_2 = [ReaperDrone() for _ in range(NUMBER_OF_DRONES)]
    my_team = [KochetovDrone() for _ in range(NUMBER_OF_DRONES)]
    team_4 = [DevastatorDrone() for _ in range(NUMBER_OF_DRONES)]
    # team_3 = [DrillerDrone() for _ in range(NUMBER_OF_DRONES)]

    scene.go()

# Зачёт!
Exemplo n.º 9
0
        if self.have_gun:
            if self.is_strategy_finished():
                self.append_strategy(StrategyHarvesting(unit=self))


class CowardDrone(DestroyerDrone):
    def on_born(self):
        self.append_strategy(StrategyHarvesting(unit=self))


if __name__ == '__main__':
    space_field = SpaceField(
        name="Space war",
        speed=5,
        field=(1600, 800),
        asteroids_count=30,
        can_fight=True,
        max_drones_at_team=12,
        # headless=True,
    )

    DRONES_COUNT = 5

    teamA = [WorkerDrone() for _ in range(DRONES_COUNT)]
    # teamB = [GreedyDrone() for _ in range(DRONES_COUNT)]
    teamC = [HunterDrone() for _ in range(DRONES_COUNT)]
    teamD = [DestroyerDrone() for _ in range(DRONES_COUNT)]
    # teamD.extend(CowardDrone() for _ in range(5))

    space_field.go()
Exemplo n.º 10
0
# -*- coding: utf-8 -*-

from astrobox.space_field import SpaceField
from teams import DrillerDrone, DevastatorDrone, KillerDrone

NUMBER_OF_DRONES = 5

if __name__ == '__main__':
    scene = SpaceField(
        field=(1300, 900),
        speed=3,
        asteroids_count=8,
        can_fight=True,
    )
    team_1 = [DrillerDrone() for _ in range(NUMBER_OF_DRONES)]
    team_2 = [DevastatorDrone() for _ in range(NUMBER_OF_DRONES)]
    team_3 = [KillerDrone() for _ in range(NUMBER_OF_DRONES)]
    scene.go()

Exemplo n.º 11
0
# -*- coding: utf-8 -*-

# pip install -r requirements.txt

from astrobox.space_field import SpaceField
from stage_03_harvesters.driller import DrillerDrone
from stage_03_harvesters.reaper import ReaperDrone
from stage_04_soldiers.devastator import DevastatorDrone
from vader import VaderDrone

NUMBER_OF_DRONES = 5

if __name__ == '__main__':
    scene = SpaceField(
        field=(900, 900),
        speed=5,
        asteroids_count=27,
        can_fight=True,
    )

    team_1 = [VaderDrone() for _ in range(NUMBER_OF_DRONES)]
    team_2 = [ReaperDrone() for _ in range(NUMBER_OF_DRONES)]
    team_3 = [DrillerDrone() for _ in range(NUMBER_OF_DRONES)]
    team_4 = [DevastatorDrone() for _ in range(NUMBER_OF_DRONES)]
    scene.go()
Exemplo n.º 12
0
def main():
    # KarpovDrone.set_logger()
    scene = SpaceField(speed=3, asteroids_count=10)
    drones = [KarpovDrone() for _ in range(DRONES_QTY)]
    scene.go()
Exemplo n.º 13
0
from astrobox.space_field import SpaceField

from side_projects.astro_game.my_drone import MyDrone

if __name__ == '__main__':
    my_space = SpaceField(
        field=(1200, 900),
        speed=2,
        asteroids_count=7
    )

    my_drones = [MyDrone() for _ in range(5)]

    my_space.go()
Exemplo n.º 14
0
# -*- coding: utf-8 -*-

# pip install -r requirements.txt
from astrobox.space_field import SpaceField
from astrobox.guns import Projectile
from stage_03_harvesters.driller import DrillerDrone
from stage_03_harvesters.reaper import ReaperDrone
from surkova import SurkovaDrone

NUMBER_OF_DRONES = 5

if __name__ == '__main__':
    scene = SpaceField(
        speed=5,
        field=(1200, 900),
        asteroids_count=20,
    )
    team_1 = [SurkovaDrone() for _ in range(NUMBER_OF_DRONES)]
    team_2 = [DrillerDrone() for _ in range(NUMBER_OF_DRONES)]
    team_3 = [ReaperDrone() for _ in range(NUMBER_OF_DRONES)]

    # TODO - Это зачем здесь?
    # for teamer in team_1:
    #     gunny = Projectile(owner=teamer, speed=5, ttl=100)
    #     for enemy in team_2:
    #         gunny.on_overlap_with(obj_status=enemy)

    scene.go()

# Третий этап: зачёт!