def __init__(self,
                 rom,
                 presetFileName,
                 difficultyTarget,
                 pickupStrategy,
                 itemsForbidden=[],
                 type='console',
                 firstItemsLog=None,
                 extStatsFilename=None,
                 extStatsStep=None,
                 displayGeneratedPath=False,
                 outputFileName=None,
                 magic=None,
                 checkDuplicateMajor=False,
                 vcr=False,
                 runtimeLimit_s=0):
        self.interactive = False
        self.checkDuplicateMajor = checkDuplicateMajor
        if vcr == True:
            from utils.vcr import VCR
            self.vcr = VCR(rom, 'solver')
        else:
            self.vcr = None
        # for compatibility with some common methods of the interactive solver
        self.mode = 'standard'

        self.log = utils.log.get('Solver')

        self.setConf(difficultyTarget, pickupStrategy, itemsForbidden,
                     displayGeneratedPath)

        self.firstLogFile = None
        if firstItemsLog is not None:
            self.firstLogFile = open(firstItemsLog, 'w')
            self.firstLogFile.write('Item;Location;Area\n')

        self.extStatsFilename = extStatsFilename
        self.extStatsStep = extStatsStep

        # can be called from command line (console) or from web site (web)
        self.type = type
        self.output = Out.factory(self.type, self)
        self.outputFileName = outputFileName

        self.loadRom(rom, magic=magic)

        self.presetFileName = presetFileName
        self.loadPreset(self.presetFileName)

        self.pickup = Pickup(Conf.itemsPickup)

        self.comeBack = ComeBack(self)

        self.runtimeLimit_s = runtimeLimit_s
        self.startTime = time.process_time()
Ejemplo n.º 2
0
    def __init__(self,
                 majorsSplit,
                 startLocation,
                 areaGraph,
                 locations,
                 vcr=None):
        self.interactive = False
        self.checkDuplicateMajor = False
        self.vcr = vcr
        # for compatibility with some common methods of the interactive solver
        self.mode = 'standard'

        self.log = utils.log.get('Solver')

        # default conf
        self.setConf(easy, 'all', [], False)

        self.firstLogFile = None

        self.extStatsFilename = None
        self.extStatsStep = None

        self.type = 'rando'
        self.output = Out.factory(self.type, self)
        self.outputFileName = None

        self.locations = locations

        self.smbm = SMBoolManager()

        # preset already loaded by rando
        self.presetFileName = None

        self.pickup = Pickup(Conf.itemsPickup)

        self.comeBack = ComeBack(self)

        # load ROM info, patches are already loaded by the rando. get the graph from the rando too
        self.majorsSplit = majorsSplit
        self.startLocation = startLocation
        self.startArea = getAccessPoint(startLocation).Start['solveArea']
        self.areaGraph = areaGraph

        self.objectives = Objectives()

        # store at each step how many locations are available
        self.nbAvailLocs = []

        # limit to a few seconds to avoid cases with a lot of rewinds which could last for minutes
        self.runtimeLimit_s = 5
        self.startTime = time.process_time()
Ejemplo n.º 3
0
    def __init__(self, majorsSplit, startAP, areaGraph, locations):
        self.interactive = False
        self.checkDuplicateMajor = False
        self.vcr = None
        # for compatibility with some common methods of the interactive solver
        self.mode = 'standard'

        self.log = utils.log.get('Solver')

        # default conf
        self.setConf(easy, 'all', [], False)

        self.firstLogFile = None

        self.extStatsFilename = None
        self.extStatsStep = None
        self.plot = None

        self.type = 'rando'
        self.output = Out.factory(self.type, self)
        self.outputFileName = None

        self.locations = locations

        self.smbm = SMBoolManager()

        # preset already loaded by rando
        self.presetFileName = None

        self.pickup = Pickup(Conf.itemsPickup)

        self.comeBack = ComeBack(self)

        # load ROM info, patches are already loaded by the rando. get the graph from the rando too
        self.majorsSplit = majorsSplit
        self.startAP = startAP
        self.startArea = getAccessPoint(startAP).Start['solveArea']
        self.areaGraph = areaGraph

        # store at each step how many locations are available
        self.nbAvailLocs = []