示例#1
0
    def printPath(self, message, locations, displayAPs=True):
        print("")
        print(message)
        print('{} {:>48} {:>12} {:>34} {:>8} {:>16} {:>14} {} {}'.format(
            "Z", "Location Name", "Area", "Sub Area", "Distance", "Item",
            "Difficulty", "Knows used", "Items used"))
        print('-' * 150)
        lastAP = None
        for loc in locations:
            if displayAPs == True and loc.path is not None:
                path = [ap.Name for ap in loc.path]
                lastAP = path[-1]
                if not (len(path) == 1 and path[0] == lastAP):
                    path = " -> ".join(path)
                    pathDiff = loc.pathDifficulty
                    print('{}: {} {} {} {}'.format(
                        'Path', path, round(float(pathDiff.difficulty), 2),
                        sorted(pathDiff.knows),
                        sorted(list(set(pathDiff.items)))))
            line = '{} {:>48}: {:>12} {:>34} {:>8} {:>16} {:>14} {} {}'

            if loc.locDifficulty is not None:
                fixEnergy(loc.locDifficulty.items)

                print(
                    line.format(
                        'Z' if loc.isChozo() else ' ', loc.Name, loc.Area,
                        loc.SolveArea,
                        loc.distance if loc.distance is not None else 'nc',
                        loc.itemName,
                        round(float(loc.locDifficulty.difficulty), 2)
                        if loc.locDifficulty is not None else 'nc',
                        sorted(loc.locDifficulty.knows)
                        if loc.locDifficulty is not None else 'nc',
                        sorted(list(set(loc.locDifficulty.items)))
                        if loc.locDifficulty is not None else 'nc'))
            elif loc.difficulty is not None:
                fixEnergy(loc.difficulty.items)

                print(
                    line.format(
                        'Z' if loc.isChozo() else ' ', loc.Name, loc.Area,
                        loc.SolveArea,
                        loc.distance if loc.distance is not None else 'nc',
                        loc.itemName, round(float(loc.difficulty.difficulty),
                                            2), sorted(loc.difficulty.knows),
                        sorted(list(set(loc.difficulty.items)))))
            else:
                print(
                    line.format(
                        'Z' if loc.isChozo() else ' ', loc.Name, loc.Area,
                        loc.SolveArea,
                        loc.distance if loc.distance is not None else 'nc',
                        loc.itemName, 'nc', 'nc', 'nc'))
示例#2
0
    def getAvailableLocationsWeb(self, locations, majorsSplit):
        ret = {}
        for loc in locations:
            if loc.difficulty is not None and loc.difficulty.bool == True:
                diff = loc.difficulty
                locName = self.name4isolver(loc.Name)
                ret[locName] = {
                    "difficulty": diff4solver(diff.difficulty),
                    "knows": self.knows2isolver(diff.knows),
                    "items": fixEnergy(list(set(diff.items))),
                    "item": loc.itemName,
                    "name": loc.Name,
                    "canHidden": loc.CanHidden,
                    "visibility": loc.Visibility,
                    "major": loc.isClass(majorsSplit)
                }

                #                if loc.locDifficulty is not None:
                #                    lDiff = loc.locDifficulty
                #                    ret[locName]["locDifficulty"] = [diff4solver(lDiff.difficulty), self.knows2isolver(lDiff.knows), list(set(lDiff.items))]
                #                if loc.pathDifficulty is not None:
                #                    pDiff = loc.pathDifficulty
                #                    ret[locName]["pathDifficulty"] = [diff4solver(pDiff.difficulty), self.knows2isolver(pDiff.knows), list(set(pDiff.items))]

                if loc.comeBack is not None:
                    ret[locName]["comeBack"] = loc.comeBack
                if loc.accessPoint is not None:
                    ret[locName]["accessPoint"] = self.transition2isolver(
                        loc.accessPoint)
                    if loc.path is not None:
                        ret[locName]["path"] = [
                            self.transition2isolver(a.Name) for a in loc.path
                        ]
                # for debug purpose
                if self.debug == True:
                    if loc.distance is not None:
                        ret[locName]["distance"] = loc.distance
        return ret
示例#3
0
    def getPath(self, locations):
        if locations is None:
            return None

        out = []
        for loc in locations:
            if loc.locDifficulty is not None:
                # draygon fight is in it's path
                if loc.Name == 'Draygon':
                    loc.locDifficulty = loc.pathDifficulty

                fixEnergy(loc.locDifficulty.items)
                fixEnergy(loc.pathDifficulty.items)

                out.append([
                    (loc.Name,
                     loc.Room), loc.Area, loc.SolveArea, loc.itemName,
                    '{0:.2f}'.format(loc.locDifficulty.difficulty),
                    sorted(loc.locDifficulty.knows),
                    sorted(list(set(loc.locDifficulty.items))),
                    '{0:.2f}'.format(loc.pathDifficulty.difficulty),
                    sorted(loc.pathDifficulty.knows),
                    sorted(list(set(loc.pathDifficulty.items))),
                    [ap.Name
                     for ap in loc.path] if loc.path is not None else None,
                    loc.Class
                ])

            else:
                fixEnergy(loc.difficulty.items)

                out.append([
                    (loc.Name, loc.Room), loc.Area, loc.SolveArea,
                    loc.itemName, '{0:.2f}'.format(loc.difficulty.difficulty),
                    sorted(loc.difficulty.knows),
                    sorted(list(set(loc.difficulty.items))), '0.00', [], [],
                    [ap.Name
                     for ap in loc.path] if loc.path is not None else None,
                    loc.Class
                ])

        return out
示例#4
0
    def getPath(self, locations):
        if locations is None:
            return None

        out = []
        order = {
            'Kraid': 0,
            'Phantoon': 1,
            'Draygon': 2,
            'Ridley': 3,
            'SporeSpawn': 4,
            'Crocomire': 5,
            'Botwoon': 6,
            'GoldenTorizo': 7,
            'Varia': 8,
            'Gravity': 9,
            'Morph': 10,
            'Bomb': 11,
            'SpringBall': 12,
            'ScrewAttack': 13,
            'HiJump': 14,
            'SpaceJump': 15,
            'SpeedBooster': 16,
            'Charge': 17,
            'Ice': 18,
            'Wave': 19,
            'Spazer': 20,
            'Plasma': 21,
            'Grapple': 22,
            'XRayScope': 23,
            'CrystalFlash': 24,
            'ETank': 25,
            'Reserve': 26,
            'Missile': 27,
            'Super': 28,
            'PowerBomb': 29
        }
        key = lambda item: order[item[item.find('-') + 1:]
                                 ] if '-' in item else order[item]
        for loc in locations:
            if loc.locDifficulty is not None:
                # draygon fight is in it's path
                if loc.Name == 'Draygon':
                    loc.locDifficulty = loc.pathDifficulty

                fixEnergy(loc.locDifficulty.items)
                fixEnergy(loc.pathDifficulty.items)

                out.append([
                    (loc.Name,
                     loc.Room), loc.Area, loc.SolveArea, loc.itemName,
                    '{0:.2f}'.format(loc.locDifficulty.difficulty),
                    sorted(loc.locDifficulty.knows),
                    sorted(list(set(loc.locDifficulty.items)), key=key),
                    '{0:.2f}'.format(loc.pathDifficulty.difficulty),
                    sorted(loc.pathDifficulty.knows),
                    sorted(list(set(loc.pathDifficulty.items)), key=key),
                    [ap.Name
                     for ap in loc.path] if loc.path is not None else None,
                    loc.Class
                ])

            else:
                fixEnergy(loc.difficulty.items)

                out.append([
                    (loc.Name, loc.Room), loc.Area, loc.SolveArea,
                    loc.itemName, '{0:.2f}'.format(loc.difficulty.difficulty),
                    sorted(loc.difficulty.knows),
                    sorted(list(set(loc.difficulty.items)),
                           key=key), '0.00', [], [],
                    [ap.Name
                     for ap in loc.path] if loc.path is not None else None,
                    loc.Class
                ])

        return out