I have been trying to get my algo to just spawn one wall to test and understand how to use a different class and not have to have everything all in one. I have tried everything I can think of at the moment. I always come to relatively the same point. Some part of the code will not be defined in some way no mater what I do. This is what I have come too so far.
“Build.py”
import gamelib
import random
import math
import warnings
from algo_strategy import *
from sys import maxsize
import json
class BuildDefences(gamelib.AlgoCore):
def phase_one(game_state):
AlgoStrategy.on_game_start(self, config)
game_state.attempt_spawn(WALL,[10,10])
gamelib.debug_write(‘Phase One Complete.’)
“algo_strategy.py”
import gamelib
import random
import math
import warnings
from build import *
from sys import maxsize
import json
class AlgoStrategy(gamelib.AlgoCore):
def init(self):
super().init()
def on_game_start(self, config):
gamelib.debug_write('Setting up vars.')
self.config = config
global WALL, SUPPORT, TURRET, SCOUT, DEMOLISHER, INTERCEPTOR, MP, SP
WALL = config["unitInformation"][0]["shorthand"]
SUPPORT = config["unitInformation"][1]["shorthand"]
TURRET = config["unitInformation"][2]["shorthand"]
SCOUT = config["unitInformation"][3]["shorthand"]
DEMOLISHER = config["unitInformation"][4]["shorthand"]
INTERCEPTOR = config["unitInformation"][5]["shorthand"]
MP = 1
SP = 0
def on_turn(self, turn_state):
game_state = gamelib.GameState(self.config, turn_state)
#game_state.attempt_spawn(WALL,[10,10])
BuildDefences.phase_one(game_state)
game_state.submit_turn()
if name == “main”:
algo = AlgoStrategy()
algo.start()
Last time I did this was back in season one and I just did a basic phase based algo all in one class. Now I want to get more advanced with it so I want to have different classes and methods I call on to make it more organized and practice with that. But I now have no idea how to even get one wall placed. Any help would be very much appreciated. Thank you in advance.