sc2simulator/setup/functions.py
def generateScenario(mapObj, options, cfg, mdata):
    """override this function is different generation methods are desired"""
    scenario = Scenario("custom%s"%mapObj.name)
    scenario.duration = options.duration
    d = options.distance # generate each player's locations
    mapLocs = defineLocs(options.loc, options.enemyloc, d)
    givenRaces = [options.race, options.enemyrace]
    for i, (pLoc, r) in enumerate(zip(mapLocs, givenRaces)):
        race = pickRace(r)
        pIdx = i + 1 # player indexes start at one, not zero
        scenario.addPlayer(pIdx, loc=pLoc, race=race)
        generatePlayerUnits(scenario, pIdx, race, options, pLoc, mapData=mdata)
        try:    generateUpgrades(scenario, pIdx, options)
        except Exception as e:
            print("ERROR: %s"%e)
            return []
        #scenario.players[pIdx].upgradeReqs
        #for u in scenario.newBaseUnits(pIdx):
        #    print("%d  %s"%(pIdx, u))
        #print()
        #for u in scenario.players[pIdx].baseUnits:
        #    print("%d  %s"%(pIdx, u))
        #print()
    return [scenario]
override this function is different generation methods are desired
override this function is different generation methods are desired
override this function is different generation methods are desired
def generateScenario(mapObj, options, cfg, mdata):
    scenario = Scenario("custom%s"%mapObj.name)
    scenario.duration = options.duration
    d = options.distance 
    mapLocs = defineLocs(options.loc, options.enemyloc, d)
    givenRaces = [options.race, options.enemyrace]
    for i, (pLoc, r) in enumerate(zip(mapLocs, givenRaces)):
        race = pickRace(r)
        pIdx = i + 1 
        scenario.addPlayer(pIdx, loc=pLoc, race=race)
        generatePlayerUnits(scenario, pIdx, race, options, pLoc, mapData=mdata)
        try:    generateUpgrades(scenario, pIdx, options)
        except Exception as e:
            print("ERROR: %s"%e)
            return []
    return [scenario]
def generateScenario ( mapObj , options , cfg , mdata ) : scenario = Scenario ( "custom%s" % mapObj . name ) scenario . duration = options . duration d = options . distance mapLocs = defineLocs ( options . loc , options . enemyloc , d ) givenRaces = [ options . race , options . enemyrace ] for i , ( pLoc , r ) in enumerate ( zip ( mapLocs , givenRaces ) ) : race = pickRace ( r ) pIdx = i + 1 scenario . addPlayer ( pIdx , loc = pLoc , race = race ) generatePlayerUnits ( scenario , pIdx , race , options , pLoc , mapData = mdata ) try : generateUpgrades ( scenario , pIdx , options ) except Exception as e : print ( "ERROR: %s" % e ) return [ ] return [ scenario ]
override this function is different generation methods are desired
override this function is different generation methods are desired
"""override this function is different generation methods are desired""" # generate each player's locations # player indexes start at one, not zero #scenario.players[pIdx].upgradeReqs #for u in scenario.newBaseUnits(pIdx): #    print("%d  %s"%(pIdx, u)) #print() #for u in scenario.players[pIdx].baseUnits: #    print("%d  %s"%(pIdx, u)) #print()
mapObj
options
cfg
mdata