Skip to content
Snippets Groups Projects
Commit d6a96beb authored by Jonas Kvarnström's avatar Jonas Kvarnström
Browse files

Merge branch 'edvth289/sc2-python-bot-correct-modules-from-the-start' into 'master'

edvth289: Change to use a Python3 module structure from the start

See merge request !10
parents c8c85abb fac29f98
No related branches found
No related tags found
1 merge request!10edvth289: Change to use a Python3 module structure from the start
......@@ -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.
File moved
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)
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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment