Skip to content

Commit

Permalink
black reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Aki Vänttinen committed Nov 25, 2024
1 parent aa3f0e1 commit ae53f39
Show file tree
Hide file tree
Showing 66 changed files with 357 additions and 175 deletions.
10 changes: 7 additions & 3 deletions bot_loader/bot_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,14 @@ def func(params: List[str], tmp_path=full_path, path2=json_path):
return bots

def add_debug_bots(self, bot_dict: Dict[str, Tuple[Callable[[List[str]], AbstractPlayer], Optional[LadderZip]]]):
""" Debug bots won't have zip function. """
"""Debug bots won't have zip function."""
debug_bots = {
"debugidle": (lambda params: Bot(race_selector(BotDefinitions.index_check(params, 0, "random")), IdleDummy())),
"debugevade": (lambda params: Bot(race_selector(BotDefinitions.index_check(params, 0, "random")), EvadeDummy())),
"debugidle": (
lambda params: Bot(race_selector(BotDefinitions.index_check(params, 0, "random")), IdleDummy())
),
"debugevade": (
lambda params: Bot(race_selector(BotDefinitions.index_check(params, 0, "random")), EvadeDummy())
),
"debugtemplate": (lambda params: Bot(Race.Zerg, TemplateSkeletonBot())),
"debugunits": (lambda params: Bot(Race.Zerg, DebugUnitsDummy())),
"debugrestorepower": (lambda params: Bot(Race.Protoss, RestorePowerDummy())),
Expand Down
4 changes: 2 additions & 2 deletions bot_loader/ladder_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ def create_bin_json(self):
return json_exe.replace("[NAME]", self.name).replace("[RACE]", self.race)

def pre_zip(self):
""" Override this as needed, actions to do before creating the zip"""
"""Override this as needed, actions to do before creating the zip"""
pass

def post_zip(self):
""" Override this as needed, actions to do after creating the zip"""
"""Override this as needed, actions to do after creating the zip"""
pass

def package_executable(self, output_dir: str):
Expand Down
2 changes: 1 addition & 1 deletion bot_loader/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run_game(
result = asyncio.get_event_loop().run_until_complete(
asyncio.gather(
_host_game(map_settings, players, **kwargs, portconfig=portconfig),
self.join_game(ladder_bot, False, portconfig, opponent_id)
self.join_game(ladder_bot, False, portconfig, opponent_id),
# ladder_bot.join_game(opponent_id, portconfig=portconfig)
)
)
Expand Down
1 change: 1 addition & 0 deletions dummies/debug/evade_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from sharpy.plans import BuildOrder
from sharpy.combat import Action, MoveType, GenericMicro, CombatModel


class MicroEvade(GenericMicro):
def __init__(self):
self.surround_move = False
Expand Down
10 changes: 8 additions & 2 deletions dummies/protoss/adept_allin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ async def create_plan(self) -> BuildOrder:
skip_until=UnitReady(UnitTypeId.GATEWAY, 1),
),
Step(
UnitReady(UnitTypeId.CYBERNETICSCORE, 1), ProtossUnit(UnitTypeId.ADEPT, 2, only_once=True),
UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
ProtossUnit(UnitTypeId.ADEPT, 2, only_once=True),
),
Tech(UpgradeId.WARPGATERESEARCH),
ProtossUnit(UnitTypeId.ADEPT, 100),
Expand All @@ -69,7 +70,12 @@ async def create_plan(self) -> BuildOrder:
GridBuilding(UnitTypeId.GATEWAY, 4),
skip_until=Minerals(200),
),
Step(None, ProtossUnit(UnitTypeId.ZEALOT, 100), skip=Gas(25), skip_until=Minerals(200),),
Step(
None,
ProtossUnit(UnitTypeId.ZEALOT, 100),
skip=Gas(25),
skip_until=Minerals(200),
),
),
),
SequentialList(
Expand Down
5 changes: 4 additions & 1 deletion dummies/protoss/cannon_rush.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ async def create_plan(self) -> BuildOrder:
],
[ProtossUnit(UnitTypeId.STALKER, 100)],
[
Step(UnitReady(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),),
Step(
UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
),
Step(UnitReady(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.GATEWAY, 7)),
StepBuildGas(4, skip=Gas(200)),
],
Expand Down
5 changes: 4 additions & 1 deletion dummies/protoss/disruptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def __init__(self):
GridBuilding(UnitTypeId.ROBOTICSFACILITY, 1, priority=True),
Tech(UpgradeId.WARPGATERESEARCH, UnitTypeId.CYBERNETICSCORE),
GridBuilding(UnitTypeId.ROBOTICSBAY, 1, priority=True),
Step(UnitExists(UnitTypeId.DISRUPTOR, 1, include_killed=True, include_not_ready=False), Expand(2),),
Step(
UnitExists(UnitTypeId.DISRUPTOR, 1, include_killed=True, include_not_ready=False),
Expand(2),
),
BuildGas(4),
),
BuildOrder(
Expand Down
8 changes: 6 additions & 2 deletions dummies/protoss/gate4.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def create_plan(self) -> BuildOrder:
AutoPylon(),
ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
SequentialList(
Step(UnitReady(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),),
Step(
UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
),
Step(UnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1), Tech(UpgradeId.BLINKTECH)),
),
SequentialList(
Expand All @@ -74,7 +77,8 @@ def create_plan(self) -> BuildOrder:
skip_until=UnitReady(UnitTypeId.GATEWAY, 1),
),
Step(
UnitReady(UnitTypeId.CYBERNETICSCORE, 1), ProtossUnit(UnitTypeId.ADEPT, 2, only_once=True),
UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
ProtossUnit(UnitTypeId.ADEPT, 2, only_once=True),
),
Tech(UpgradeId.WARPGATERESEARCH),
ProtossUnit(UnitTypeId.STALKER, 100),
Expand Down
5 changes: 4 additions & 1 deletion dummies/protoss/proxy_zealot_rush.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ async def create_plan(self) -> BuildOrder:
StepBuildGas(5, skip=Gas(200)),
],
SequentialList(
Step(UnitReady(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),),
Step(
UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
),
GridBuilding(UnitTypeId.STARGATE, 1),
Step(UnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1), Tech(UpgradeId.CHARGE)),
Step(UnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1), Tech(UpgradeId.ADEPTPIERCINGATTACK)),
Expand Down
3 changes: 2 additions & 1 deletion dummies/protoss/robo.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ async def create_plan(self) -> BuildOrder:
SequentialList(
[
Step(
UnitReady(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
),
GridBuilding(UnitTypeId.ROBOTICSFACILITY, 1),
Step(UnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1), Tech(UpgradeId.CHARGE)),
Expand Down
3 changes: 2 additions & 1 deletion dummies/protoss/voidray.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ async def create_plan(self) -> BuildOrder:
SequentialList(
[
Step(
UnitReady(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
),
GridBuilding(UnitTypeId.STARGATE, 1),
Step(UnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1), Tech(UpgradeId.CHARGE)),
Expand Down
6 changes: 4 additions & 2 deletions dummies/terran/banshees.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ async def create_plan(self) -> BuildOrder:
Step(None, BuildAddon(UnitTypeId.BARRACKSREACTOR, UnitTypeId.BARRACKS, 1)),
Step(None, GridBuilding(UnitTypeId.STARPORT, 2)),
Step(
UnitReady(UnitTypeId.STARPORT, 2), BuildAddon(UnitTypeId.STARPORTTECHLAB, UnitTypeId.STARPORT, 2),
UnitReady(UnitTypeId.STARPORT, 2),
BuildAddon(UnitTypeId.STARPORTTECHLAB, UnitTypeId.STARPORT, 2),
),
Step(None, Tech(UpgradeId.SHIELDWALL)),
Step(Minerals(600), GridBuilding(UnitTypeId.BARRACKS, 5)),
Expand All @@ -89,7 +90,8 @@ async def create_plan(self) -> BuildOrder:
None,
),
Step(
UnitReady(UnitTypeId.STARPORT, 1), ActUnit(UnitTypeId.RAVEN, UnitTypeId.STARPORT, 2, priority=True),
UnitReady(UnitTypeId.STARPORT, 1),
ActUnit(UnitTypeId.RAVEN, UnitTypeId.STARPORT, 2, priority=True),
),
],
ActUnit(UnitTypeId.BANSHEE, UnitTypeId.STARPORT, 20, priority=True),
Expand Down
9 changes: 6 additions & 3 deletions dummies/terran/battle_cruisers.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,15 @@ async def create_plan(self) -> BuildOrder:
4, None, UnitExists(UnitTypeId.BATTLECRUISER, 1, include_killed=True, include_pending=True)
),
Step(
UnitExists(UnitTypeId.BATTLECRUISER, 1, include_killed=True), GridBuilding(UnitTypeId.BARRACKS, 3),
UnitExists(UnitTypeId.BATTLECRUISER, 1, include_killed=True),
GridBuilding(UnitTypeId.BARRACKS, 3),
),
Step(None, BuildAddon(UnitTypeId.BARRACKSTECHLAB, UnitTypeId.BARRACKS, 1)),
Step(None, BuildAddon(UnitTypeId.BARRACKSREACTOR, UnitTypeId.BARRACKS, 1)),
Step(None, GridBuilding(UnitTypeId.STARPORT, 2)),
Step(
UnitReady(UnitTypeId.STARPORT, 2), BuildAddon(UnitTypeId.STARPORTTECHLAB, UnitTypeId.STARPORT, 2),
UnitReady(UnitTypeId.STARPORT, 2),
BuildAddon(UnitTypeId.STARPORTTECHLAB, UnitTypeId.STARPORT, 2),
),
Step(None, Tech(UpgradeId.SHIELDWALL)),
Step(Minerals(600), GridBuilding(UnitTypeId.BARRACKS, 5)),
Expand All @@ -134,7 +136,8 @@ async def create_plan(self) -> BuildOrder:
None,
),
Step(
UnitReady(UnitTypeId.STARPORT, 1), ActUnit(UnitTypeId.RAVEN, UnitTypeId.STARPORT, 2, priority=True),
UnitReady(UnitTypeId.STARPORT, 1),
ActUnit(UnitTypeId.RAVEN, UnitTypeId.STARPORT, 2, priority=True),
),
],
Step(
Expand Down
11 changes: 9 additions & 2 deletions dummies/terran/cyclones.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ async def create_plan(self) -> BuildOrder:
Step(None, Expand(3)),
GridBuilding(UnitTypeId.FACTORY, 2),
BuildAddon(UnitTypeId.FACTORYTECHLAB, UnitTypeId.FACTORY, 2),
Step(None, Tech(UpgradeId.CYCLONELOCKONDAMAGEUPGRADE), skip_until=UnitReady(UnitTypeId.FACTORYTECHLAB, 1),),
Step(
None,
Tech(UpgradeId.CYCLONELOCKONDAMAGEUPGRADE),
skip_until=UnitReady(UnitTypeId.FACTORYTECHLAB, 1),
),
BuildGas(5),
Step(None, Tech(UpgradeId.HIGHCAPACITYBARRELS), skip_until=UnitReady(UnitTypeId.FACTORYTECHLAB, 2)),
StepBuildGas(6, None, Gas(100)),
Expand Down Expand Up @@ -93,7 +97,10 @@ async def create_plan(self) -> BuildOrder:
],
[
Step(None, ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 40)),
Step(UnitExists(UnitTypeId.COMMANDCENTER, 3), ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 70),),
Step(
UnitExists(UnitTypeId.COMMANDCENTER, 3),
ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 70),
),
],
upgrades,
ActUnit(UnitTypeId.MARINE, UnitTypeId.BARRACKS, 4),
Expand Down
5 changes: 4 additions & 1 deletion dummies/terran/rusty.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def __init__(self):
buildings = [
Step(Supply(13), GridBuilding(UnitTypeId.SUPPLYDEPOT, 1)),
StepBuildGas(1, Supply(16)),
Step(UnitExists(UnitTypeId.SUPPLYDEPOT), GridBuilding(UnitTypeId.BARRACKS, 1),),
Step(
UnitExists(UnitTypeId.SUPPLYDEPOT),
GridBuilding(UnitTypeId.BARRACKS, 1),
),
Step(UnitReady(UnitTypeId.BARRACKS, 0.25), GridBuilding(UnitTypeId.SUPPLYDEPOT, 2)),
StepBuildGas(1, Supply(18)),
Step(UnitExists(UnitTypeId.MARINE, 1), Expand(2)),
Expand Down
24 changes: 19 additions & 5 deletions dummies/terran/safe_tvt_raven.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ async def create_plan(self) -> BuildOrder:
Step(
UnitExists(UnitTypeId.FACTORY, include_pending=True),
BuildOrder(
TerranUnit(UnitTypeId.REAPER, 3, only_once=True), TerranUnit(UnitTypeId.HELLION, 2, only_once=True),
TerranUnit(UnitTypeId.REAPER, 3, only_once=True),
TerranUnit(UnitTypeId.HELLION, 2, only_once=True),
),
),
BuildOrder(
Expand Down Expand Up @@ -168,7 +169,10 @@ async def create_plan(self) -> BuildOrder:
units,
# Build structures
[
Step(Supply(14), GridBuilding(UnitTypeId.SUPPLYDEPOT, 1),),
Step(
Supply(14),
GridBuilding(UnitTypeId.SUPPLYDEPOT, 1),
),
BuildGas(1),
GridBuilding(UnitTypeId.BARRACKS, 1),
StepBuildGas(2, requirement=Supply(17)),
Expand All @@ -189,7 +193,10 @@ async def create_plan(self) -> BuildOrder:
BuildGas(3),
# At around 4:20, this command center should be placed in-base and flown out later
# TODO Build 3rd CC inbase if possible
Step(Time(4 * 60 + 20), Expand(3),),
Step(
Time(4 * 60 + 20),
Expand(3),
),
AutoDepot(),
Step(
UnitExists(UnitTypeId.RAVEN, 2, include_pending=True, include_killed=True),
Expand All @@ -211,11 +218,18 @@ async def create_plan(self) -> BuildOrder:
GridBuilding(UnitTypeId.BARRACKS, 5),
),
# Add 2nd factory when combatshield is nearly done
Step(TechReady(UpgradeId.SHIELDWALL, 0.6), GridBuilding(UnitTypeId.FACTORY, 2),),
Step(
TechReady(UpgradeId.SHIELDWALL, 0.6),
GridBuilding(UnitTypeId.FACTORY, 2),
),
# Add armory when +1 attack is nearly done
Step(
TechReady(UpgradeId.TERRANINFANTRYWEAPONSLEVEL1, 0.6),
GridBuilding(UnitTypeId.ARMORY, 1, priority=True,),
GridBuilding(
UnitTypeId.ARMORY,
1,
priority=True,
),
),
# Research upgrades
research,
Expand Down
6 changes: 5 additions & 1 deletion dummies/zerg/lings.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ def __init__(self):
UnitExists(UnitTypeId.QUEEN, 1),
),
Step(UnitExists(UnitTypeId.SPAWNINGPOOL, 1), ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 20), None),
Step(UnitExists(UnitTypeId.SPAWNINGPOOL, 1), ActUnitOnce(UnitTypeId.ZERGLING, UnitTypeId.LARVA, 12), None,),
Step(
UnitExists(UnitTypeId.SPAWNINGPOOL, 1),
ActUnitOnce(UnitTypeId.ZERGLING, UnitTypeId.LARVA, 12),
None,
),
Step(UnitExists(UnitTypeId.SPAWNINGPOOL, 1), ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 30), None),
# Endless zerglings
Step(UnitExists(UnitTypeId.SPAWNINGPOOL, 1), ActUnit(UnitTypeId.ZERGLING, UnitTypeId.LARVA), None),
Expand Down
Loading

0 comments on commit ae53f39

Please sign in to comment.