def printPolicy(self, policy, policyTypeIsGrid):
        if policyTypeIsGrid:
            legend = {'N': 'N', 'E': 'E', 'S': 'S', 'W': 'W', ' ': '_'}
        else:
            legend = {
                'north': 'N',
                'east': 'E',
                'south': 'S',
                'west': 'W',
                'exit': 'X',
                '.': '.',
                ' ': '_'}

        for ybar in range(self.grid.grid.height):
            y = self.grid.grid.height - ybar - 1
            if policyTypeIsGrid:
                self.addMessage(
                    "        %s" %
                    ("    ".join([legend[policy[x][y]] for x in range(self.grid.grid.width)]),))
            else:
                self.addMessage(
                    "        %s" %
                    ("    ".join([legend[policy.get((x, y), '.')] for x in range(self.grid.grid.width)]),))
        # for state in sorted(self.grid.getStates()):
        #     if state != 'TERMINAL_STATE':
        #         self.addMessage('      (%s,%s) %s' % (state[0], state[1], policy[state]))
dataset/ETHPy150Open rlpy/rlpy/rlpy/Domains/PacmanPackage/reinforcementTestClasses.py/GridPolicyTest.printPolicy/swapped operands of `-`