diff --git a/README.md b/README.md index 7637e198cece368277d3d028a8ed76be500857e2..a8c062078a1c699401693d01e28286610d1aa037 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,11 @@ This repository contains a passive PyCommandCenter-based bot for StarCraft II. I 4. Everything is now ready for PyCharm: Start PyCharm, and then select "Open" and navigate to the location you cloned your fork of this repository to. -5. In order to run the code, right click the file named "main.py" in the project panel to the right, and select "Debug main". This will run the code in "main.py", and consequently start StarCraft II. You can also edit the code in "main.py" by double-clicking "main.py". +5. In order to run the code, right click the file named "start.py" in the + project panel to the right, and select "Debug main". This will run the code + in "start.py", and consequently start StarCraft II. You can also edit the + code in "start.py" by double-clicking "start.py". + +6. Rename the folder 'myagent' to something unique, preferably with your group number + in the name. This will make it easier when you want to run against other bots. So make + sure ALL of the source code for the bot lives in that folder. diff --git a/extra.py b/myagent/extra.py similarity index 100% rename from extra.py rename to myagent/extra.py diff --git a/myagent/main.py b/myagent/main.py new file mode 100644 index 0000000000000000000000000000000000000000..baf9dc905813f15ad3d6b26046315fe09ed3a472 --- /dev/null +++ b/myagent/main.py @@ -0,0 +1,14 @@ +from typing import Optional +from library import * +from myagent.extra import * + + +class MyAgent(IDABot): + def __init__(self): + IDABot.__init__(self) + + def on_game_start(self): + IDABot.on_game_start(self) + + def on_step(self): + IDABot.on_step(self) diff --git a/main.py b/start.py similarity index 55% rename from main.py rename to start.py index 191081720b96ae150fe3d06c03c6c432764482e9..5a6bc357b3f58a604be4be31091685963abec37d 100644 --- a/main.py +++ b/start.py @@ -1,29 +1,24 @@ import os -from typing import Optional -from library import * - - -class MyAgent(IDABot): - def __init__(self): - IDABot.__init__(self) - - def on_game_start(self): - IDABot.on_game_start(self) - - def on_step(self): - IDABot.on_step(self) +from library import ( + Coordinator, Difficulty, Race, + create_participants, create_computer, +) +from myagent.main import MyAgent def main(): + fight_against_agent = False coordinator = Coordinator(r"D:\StarCraft II\Versions\Base69232\SC2_x64.exe") - bot1 = MyAgent() - # bot2 = MyAgent() + bot1 = MyAgent() participant_1 = create_participants(Race.Terran, bot1) - # participant_2 = create_participants(Race.Terran, bot2) - participant_2 = create_computer(Race.Random, Difficulty.Easy) + if fight_against_agent: + bot2 = MyAgent() # Change me + participant_2 = create_participants(Race.Terran, bot2) + else: + participant_2 = create_computer(Race.Random, Difficulty.Easy) coordinator.set_real_time(True) coordinator.set_participants([participant_1, participant_2]) @@ -37,4 +32,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()