Module pacai.ui.gridworld.gui
Functions
def blank()
def drawNullSquare(grid, x, y, isObstacle, isTerminal, isCurrent)
def drawNullValues(gridworld, currentState=None, message='')
def drawQValues(gridworld, qValues, currentState=None, message='State-Action Q-Values')
def drawSquare(x, y, val, min, max, valStr, action, isObstacle, isTerminal, isCurrent)
def drawSquareQ(x, y, qVals, minVal, maxVal, valStrs, bestActions, isCurrent)
def drawValues(gridworld, values, policy, currentState=None, message='State Values')
def getColor(val, minVal, max)
def setup(gridworld, title='Gridworld Display', size=120)
def square(pos, size, color, filled, width)
def to_grid(point)
def to_screen(point)
Classes
class GraphicsGridworldDisplay (gridworld, size=120, speed=1.0)
-
A GUI display for gridworld.
Expand source code
class GraphicsGridworldDisplay(object): """ A GUI display for gridworld. """ def __init__(self, gridworld, size=120, speed=1.0): self.gridworld = gridworld self.size = size self.speed = speed def start(self): setup(self.gridworld, size=self.size) def pause(self): utils.wait_for_keys() def displayValues(self, agent, currentState = None, message = 'Agent Values'): values = {} policy = {} states = self.gridworld.getStates() for state in states: values[state] = agent.getValue(state) policy[state] = agent.getPolicy(state) drawValues(self.gridworld, values, policy, currentState, message) utils.sleep(0.05 / self.speed) def displayNullValues(self, currentState = None, message = ''): values = {} states = self.gridworld.getStates() for state in states: values[state] = 0.0 drawNullValues(self.gridworld, currentState, '') utils.sleep(0.05 / self.speed) def displayQValues(self, agent, currentState = None, message = 'Agent Q-Values'): qValues = {} states = self.gridworld.getStates() for state in states: for action in self.gridworld.getPossibleActions(state): qValues[(state, action)] = agent.getQValue(state, action) drawQValues(self.gridworld, qValues, currentState, message) utils.sleep(0.05 / self.speed)
Methods
def displayNullValues(self, currentState=None, message='')
def displayQValues(self, agent, currentState=None, message='Agent Q-Values')
def displayValues(self, agent, currentState=None, message='Agent Values')
def pause(self)
def start(self)