SYMBOL INDEX (2632 symbols across 105 files) FILE: Project-1/autograder.py function readCommand (line 31) | def readCommand(argv): function confirmGenerate (line 83) | def confirmGenerate(): function setModuleName (line 100) | def setModuleName(module, filename): function loadModuleString (line 118) | def loadModuleString(moduleSource): function loadModuleFile (line 131) | def loadModuleFile(moduleName, filePath): function readFile (line 136) | def readFile(path, root=""): function splitStrings (line 173) | def splitStrings(d): function printTest (line 184) | def printTest(testDict, solutionDict): function runTest (line 194) | def runTest(testName, moduleDict, printTestCase=False, display=None): function getDepends (line 219) | def getDepends(testParser, testRoot, question): function getTestSubdirs (line 230) | def getTestSubdirs(testParser, testRoot, questionToGrade): function evaluate (line 243) | def evaluate(generateSolutions, testRoot, moduleDict, exceptionMap=ERROR... function getDisplay (line 310) | def getDisplay(graphicsByDefault, options=None): FILE: Project-1/eightpuzzle.py class EightPuzzleState (line 20) | class EightPuzzleState: method __init__ (line 30) | def __init__( self, numbers ): method isGoal (line 62) | def isGoal( self ): method legalMoves (line 88) | def legalMoves( self ): method result (line 110) | def result(self, move): method __eq__ (line 149) | def __eq__(self, other): method __hash__ (line 163) | def __hash__(self): method __getAsciiString (line 166) | def __getAsciiString(self): method __str__ (line 183) | def __str__(self): class EightPuzzleSearchProblem (line 188) | class EightPuzzleSearchProblem(search.SearchProblem): method __init__ (line 194) | def __init__(self,puzzle): method getStartState (line 198) | def getStartState(self): method isGoalState (line 201) | def isGoalState(self,state): method getSuccessors (line 204) | def getSuccessors(self,state): method getCostOfActions (line 215) | def getCostOfActions(self, actions): function loadEightPuzzle (line 231) | def loadEightPuzzle(puzzleNumber): function createRandomEightPuzzle (line 251) | def createRandomEightPuzzle(moves=100): FILE: Project-1/game.py class Agent (line 32) | class Agent: method __init__ (line 39) | def __init__(self, index=0): method getAction (line 42) | def getAction(self, state): class Directions (line 49) | class Directions: class Configuration (line 70) | class Configuration: method __init__ (line 79) | def __init__(self, pos, direction): method getPosition (line 83) | def getPosition(self): method getDirection (line 86) | def getDirection(self): method isInteger (line 89) | def isInteger(self): method __eq__ (line 93) | def __eq__(self, other): method __hash__ (line 97) | def __hash__(self): method __str__ (line 102) | def __str__(self): method generateSuccessor (line 105) | def generateSuccessor(self, vector): class AgentState (line 120) | class AgentState: method __init__ (line 125) | def __init__( self, startConfiguration, isPacman ): method __str__ (line 133) | def __str__( self ): method __eq__ (line 139) | def __eq__( self, other ): method __hash__ (line 144) | def __hash__(self): method copy (line 147) | def copy( self ): method getPosition (line 155) | def getPosition(self): method getDirection (line 159) | def getDirection(self): class Grid (line 162) | class Grid: method __init__ (line 170) | def __init__(self, width, height, initialValue=False, bitRepresentatio... method __getitem__ (line 180) | def __getitem__(self, i): method __setitem__ (line 183) | def __setitem__(self, key, item): method __str__ (line 186) | def __str__(self): method __eq__ (line 191) | def __eq__(self, other): method __hash__ (line 195) | def __hash__(self): method copy (line 206) | def copy(self): method deepCopy (line 211) | def deepCopy(self): method shallowCopy (line 214) | def shallowCopy(self): method count (line 219) | def count(self, item =True ): method asList (line 222) | def asList(self, key = True): method packBits (line 229) | def packBits(self): method _cellIndexToPosition (line 248) | def _cellIndexToPosition(self, index): method _unpackBits (line 253) | def _unpackBits(self, bits): method _unpackInt (line 265) | def _unpackInt(self, packed, size): function reconstituteGrid (line 277) | def reconstituteGrid(bitRep): class Actions (line 287) | class Actions: method reverseDirection (line 302) | def reverseDirection(action): method vectorToDirection (line 314) | def vectorToDirection(vector): method directionToVector (line 327) | def directionToVector(direction, speed = 1.0): method getPossibleActions (line 332) | def getPossibleActions(config, walls): method getLegalNeighbors (line 351) | def getLegalNeighbors(position, walls): method getSuccessor (line 365) | def getSuccessor(position, action): class GameStateData (line 371) | class GameStateData: method __init__ (line 375) | def __init__( self, prevState = None ): method deepCopy (line 395) | def deepCopy( self ): method copyAgentStates (line 405) | def copyAgentStates( self, agentStates ): method __eq__ (line 411) | def __eq__( self, other ): method __hash__ (line 423) | def __hash__( self ): method __str__ (line 435) | def __str__( self ): method _foodWallStr (line 460) | def _foodWallStr( self, hasFood, hasWall ): method _pacStr (line 468) | def _pacStr( self, dir ): method _ghostStr (line 477) | def _ghostStr( self, dir ): method initialize (line 487) | def initialize( self, layout, numGhostAgents ): class Game (line 513) | class Game: method __init__ (line 518) | def __init__( self, agents, display, rules, startingIndex=0, muteAgent... method getProgress (line 534) | def getProgress(self): method _agentCrash (line 540) | def _agentCrash( self, agentIndex, quiet=False): method mute (line 550) | def mute(self, agentIndex): method unmute (line 559) | def unmute(self): method run (line 567) | def run( self ): FILE: Project-1/ghostAgents.py class GhostAgent (line 22) | class GhostAgent( Agent ): method __init__ (line 23) | def __init__( self, index ): method getAction (line 26) | def getAction( self, state ): method getDistribution (line 33) | def getDistribution(self, state): class RandomGhost (line 37) | class RandomGhost( GhostAgent ): method getDistribution (line 39) | def getDistribution( self, state ): class DirectionalGhost (line 45) | class DirectionalGhost( GhostAgent ): method __init__ (line 47) | def __init__( self, index, prob_attack=0.8, prob_scaredFlee=0.8 ): method getDistribution (line 52) | def getDistribution( self, state ): FILE: Project-1/grading.py class Grades (line 25) | class Grades: method __init__ (line 27) | def __init__(self, projectName, questionsAndMaxesList, edxOutput=False... method addPrereq (line 48) | def addPrereq(self, question, prereq): method grade (line 51) | def grade(self, gradingModule, exceptionMap = {}, bonusPic = False): method addExceptionMessage (line 139) | def addExceptionMessage(self, q, inst, traceback): method addErrorHints (line 149) | def addErrorHints(self, exceptionMap, errorInstance, questionNum): method produceOutput (line 171) | def produceOutput(self): method fail (line 227) | def fail(self, message, raw=False): method assignZeroCredit (line 233) | def assignZeroCredit(self): method addPoints (line 236) | def addPoints(self, amt): method deductPoints (line 239) | def deductPoints(self, amt): method assignFullCredit (line 242) | def assignFullCredit(self, message="", raw=False): method addMessage (line 247) | def addMessage(self, message, raw=False): method addMessageToEmail (line 256) | def addMessageToEmail(self, message): class Counter (line 267) | class Counter(dict): method __getitem__ (line 271) | def __getitem__(self, idx): method totalCount (line 277) | def totalCount(self): FILE: Project-1/graphicsDisplay.py class InfoPane (line 82) | class InfoPane: method __init__ (line 83) | def __init__(self, layout, gridSize): method toScreen (line 92) | def toScreen(self, pos, y = None): method drawPane (line 105) | def drawPane(self): method initializeGhostDistances (line 108) | def initializeGhostDistances(self, distances): method updateScore (line 121) | def updateScore(self, score): method setTeam (line 124) | def setTeam(self, isBlue): method updateGhostDistances (line 129) | def updateGhostDistances(self, distances): method drawGhost (line 136) | def drawGhost(self): method drawPacman (line 139) | def drawPacman(self): method drawWarning (line 142) | def drawWarning(self): method clearIcon (line 145) | def clearIcon(self): method updateMessage (line 148) | def updateMessage(self, message): method clearMessage (line 151) | def clearMessage(self): class PacmanGraphics (line 155) | class PacmanGraphics: method __init__ (line 156) | def __init__(self, zoom=1.0, frameTime=0.0, capture=False): method checkNullDisplay (line 165) | def checkNullDisplay(self): method initialize (line 168) | def initialize(self, state, isBlue = False): method startGraphics (line 180) | def startGraphics(self, state): method drawDistributions (line 189) | def drawDistributions(self, state): method drawStaticObjects (line 204) | def drawStaticObjects(self, state): method drawAgentObjects (line 211) | def drawAgentObjects(self, state): method swapImages (line 222) | def swapImages(self, agentIndex, newState): method update (line 236) | def update(self, newState): method make_window (line 256) | def make_window(self, width, height): method drawPacman (line 267) | def drawPacman(self, pacman, index): method getEndpoints (line 286) | def getEndpoints(self, direction, position=(0,0)): method movePacman (line 302) | def movePacman(self, position, direction, image): method animatePacman (line 309) | def animatePacman(self, pacman, prevPacman, image): method getGhostColor (line 329) | def getGhostColor(self, ghost, ghostIndex): method drawGhost (line 335) | def drawGhost(self, ghost, agentIndex): method moveEyes (line 371) | def moveEyes(self, pos, dir, eyes): method moveGhost (line 388) | def moveGhost(self, ghost, ghostIndex, prevGhost, ghostImageParts): method getPosition (line 405) | def getPosition(self, agentState): method getDirection (line 409) | def getDirection(self, agentState): method finish (line 413) | def finish(self): method to_screen (line 416) | def to_screen(self, point): method to_screen2 (line 424) | def to_screen2(self, point): method drawWalls (line 431) | def drawWalls(self, wallMatrix): method isWall (line 517) | def isWall(self, x, y, walls): method drawFood (line 524) | def drawFood(self, foodMatrix ): method drawCapsules (line 544) | def drawCapsules(self, capsules ): method removeFood (line 556) | def removeFood(self, cell, foodImages ): method removeCapsule (line 560) | def removeCapsule(self, cell, capsuleImages ): method drawExpandedCells (line 564) | def drawExpandedCells(self, cells): method clearExpandedCells (line 583) | def clearExpandedCells(self): method updateDistributions (line 589) | def updateDistributions(self, distributions): class FirstPersonPacmanGraphics (line 611) | class FirstPersonPacmanGraphics(PacmanGraphics): method __init__ (line 612) | def __init__(self, zoom = 1.0, showGhosts = True, capture = False, fra... method initialize (line 617) | def initialize(self, state, isBlue = False): method lookAhead (line 634) | def lookAhead(self, config, state): method getGhostColor (line 648) | def getGhostColor(self, ghost, ghostIndex): method getPosition (line 651) | def getPosition(self, ghostState): function add (line 657) | def add(x, y): function saveFrame (line 672) | def saveFrame(): FILE: Project-1/graphicsUtils.py function formatColor (line 35) | def formatColor(r, g, b): function colorToVector (line 38) | def colorToVector(color): function sleep (line 47) | def sleep(secs): function begin_graphics (line 56) | def begin_graphics(width=640, height=480, color=formatColor(0, 0, 0), ti... function _leftclick (line 101) | def _leftclick(event): function _rightclick (line 105) | def _rightclick(event): function _ctrl_leftclick (line 109) | def _ctrl_leftclick(event): function wait_for_click (line 113) | def wait_for_click(): function draw_background (line 132) | def draw_background(): function _destroy_window (line 136) | def _destroy_window(event=None): function end_graphics (line 143) | def end_graphics(): function clear_screen (line 158) | def clear_screen(background=None): function polygon (line 164) | def polygon(coords, outlineColor, fillColor=None, filled=1, smoothed=1, ... function square (line 176) | def square(pos, r, color, filled=1, behind=0): function circle (line 181) | def circle(pos, r, outlineColor, fillColor, endpoints=None, style='piesl... function image (line 194) | def image(pos, file="../../blueghost.gif"): function refresh (line 200) | def refresh(): function moveCircle (line 203) | def moveCircle(id, pos, r, endpoints=None): function edit (line 220) | def edit(id, *args): function text (line 223) | def text(pos, color, contents, font='Helvetica', size=12, style='normal'... function changeText (line 229) | def changeText(id, newText, font=None, size=12, style='normal'): function changeColor (line 234) | def changeColor(id, newColor): function line (line 237) | def line(here, there, color=formatColor(0, 0, 0), width=2): function _keypress (line 254) | def _keypress(event): function _keyrelease (line 262) | def _keyrelease(event): function remap_arrows (line 271) | def remap_arrows(event): function _clear_keys (line 284) | def _clear_keys(event=None): function keys_pressed (line 290) | def keys_pressed(d_o_e=Tkinter.tkinter.dooneevent, function keys_waiting (line 297) | def keys_waiting(): function wait_for_keys (line 305) | def wait_for_keys(): function remove_from_screen (line 312) | def remove_from_screen(x, function _adjust_coords (line 318) | def _adjust_coords(coord_list, x, y): function move_to (line 324) | def move_to(object, x, y=None, function move_by (line 346) | def move_by(object, x, y=None, function writePostscript (line 369) | def writePostscript(filename): FILE: Project-1/keyboardAgents.py class KeyboardAgent (line 19) | class KeyboardAgent(Agent): method __init__ (line 30) | def __init__( self, index = 0 ): method getAction (line 36) | def getAction( self, state): method getMove (line 59) | def getMove(self, legal): class KeyboardAgent2 (line 67) | class KeyboardAgent2(KeyboardAgent): method getMove (line 78) | def getMove(self, legal): FILE: Project-1/layout.py class Layout (line 22) | class Layout: method __init__ (line 27) | def __init__(self, layoutText): method getNumGhosts (line 40) | def getNumGhosts(self): method initializeVisibilityMatrix (line 43) | def initializeVisibilityMatrix(self): method isWall (line 64) | def isWall(self, pos): method getRandomLegalPosition (line 68) | def getRandomLegalPosition(self): method getRandomCorner (line 76) | def getRandomCorner(self): method getFurthestCorner (line 80) | def getFurthestCorner(self, pacPos): method isVisibleFrom (line 85) | def isVisibleFrom(self, ghostPos, pacPos, pacDirection): method __str__ (line 89) | def __str__(self): method deepCopy (line 92) | def deepCopy(self): method processLayoutText (line 95) | def processLayoutText(self, layoutText): method processLayoutChar (line 116) | def processLayoutChar(self, x, y, layoutChar): function getLayout (line 131) | def getLayout(name, back = 2): function tryToLoad (line 145) | def tryToLoad(fullname): FILE: Project-1/pacman.py class GameState (line 55) | class GameState: method getAndResetExplored (line 76) | def getAndResetExplored(): method getLegalActions (line 82) | def getLegalActions( self, agentIndex=0 ): method generateSuccessor (line 94) | def generateSuccessor( self, agentIndex, action): method getLegalPacmanActions (line 127) | def getLegalPacmanActions( self ): method generatePacmanSuccessor (line 130) | def generatePacmanSuccessor( self, action ): method getPacmanState (line 136) | def getPacmanState( self ): method getPacmanPosition (line 145) | def getPacmanPosition( self ): method getGhostStates (line 148) | def getGhostStates( self ): method getGhostState (line 151) | def getGhostState( self, agentIndex ): method getGhostPosition (line 156) | def getGhostPosition( self, agentIndex ): method getGhostPositions (line 161) | def getGhostPositions(self): method getNumAgents (line 164) | def getNumAgents( self ): method getScore (line 167) | def getScore( self ): method getCapsules (line 170) | def getCapsules(self): method getNumFood (line 176) | def getNumFood( self ): method getFood (line 179) | def getFood(self): method getWalls (line 191) | def getWalls(self): method hasFood (line 203) | def hasFood(self, x, y): method hasWall (line 206) | def hasWall(self, x, y): method isLose (line 209) | def isLose( self ): method isWin (line 212) | def isWin( self ): method __init__ (line 220) | def __init__( self, prevState = None ): method deepCopy (line 229) | def deepCopy( self ): method __eq__ (line 234) | def __eq__( self, other ): method __hash__ (line 240) | def __hash__( self ): method __str__ (line 246) | def __str__( self ): method initialize (line 250) | def initialize( self, layout, numGhostAgents=1000 ): class ClassicGameRules (line 266) | class ClassicGameRules: method __init__ (line 271) | def __init__(self, timeout=30): method newGame (line 274) | def newGame( self, layout, pacmanAgent, ghostAgents, display, quiet = ... method process (line 284) | def process(self, state, game): method win (line 291) | def win( self, state, game ): method lose (line 295) | def lose( self, state, game ): method getProgress (line 299) | def getProgress(self, game): method agentCrash (line 302) | def agentCrash(self, game, agentIndex): method getMaxTotalTime (line 308) | def getMaxTotalTime(self, agentIndex): method getMaxStartupTime (line 311) | def getMaxStartupTime(self, agentIndex): method getMoveWarningTime (line 314) | def getMoveWarningTime(self, agentIndex): method getMoveTimeout (line 317) | def getMoveTimeout(self, agentIndex): method getMaxTimeWarnings (line 320) | def getMaxTimeWarnings(self, agentIndex): class PacmanRules (line 323) | class PacmanRules: method getLegalActions (line 330) | def getLegalActions( state ): method applyAction (line 337) | def applyAction( state, action ): method consume (line 359) | def consume( position, state ): class GhostRules (line 381) | class GhostRules: method getLegalActions (line 386) | def getLegalActions( state, ghostIndex ): method applyAction (line 401) | def applyAction( state, action, ghostIndex): method decrementTimer (line 414) | def decrementTimer( ghostState): method checkDeath (line 421) | def checkDeath( state, agentIndex): method collide (line 436) | def collide( state, ghostState, agentIndex): method canKill (line 449) | def canKill( pacmanPosition, ghostPosition ): method placeGhost (line 453) | def placeGhost(state, ghostState): function default (line 461) | def default(str): function parseAgentArgs (line 464) | def parseAgentArgs(str): function readCommand (line 476) | def readCommand( argv ): function loadAgent (line 587) | def loadAgent(pacman, nographics): function replayGame (line 610) | def replayGame( layout, actions, display ): function runGames (line 628) | def runGames( layout, pacman, ghosts, display, numGames, record, numTrai... FILE: Project-1/pacmanAgents.py class LeftTurnAgent (line 21) | class LeftTurnAgent(game.Agent): method getAction (line 24) | def getAction(self, state): class GreedyAgent (line 35) | class GreedyAgent(Agent): method __init__ (line 36) | def __init__(self, evalFn="scoreEvaluation"): method getAction (line 40) | def getAction(self, state): function scoreEvaluation (line 51) | def scoreEvaluation(state): FILE: Project-1/search.py class SearchProblem (line 22) | class SearchProblem: method getStartState (line 30) | def getStartState(self): method isGoalState (line 36) | def isGoalState(self, state): method getSuccessors (line 44) | def getSuccessors(self, state): method getCostOfActions (line 55) | def getCostOfActions(self, actions): class Path (line 64) | class Path(object): method __init__ (line 65) | def __init__(self, locations, directions, cost): function tinyMazeSearch (line 70) | def tinyMazeSearch(problem): function depthFirstSearch (line 80) | def depthFirstSearch(problem): function breadthFirstSearch (line 113) | def breadthFirstSearch(problem): function uniformCostSearch (line 149) | def uniformCostSearch(problem): function nullHeuristic (line 185) | def nullHeuristic(state, problem=None): function aStarSearch (line 192) | def aStarSearch(problem, heuristic=nullHeuristic): FILE: Project-1/searchAgents.py class GoWestAgent (line 44) | class GoWestAgent(Agent): method getAction (line 47) | def getAction(self, state): class SearchAgent (line 59) | class SearchAgent(Agent): method __init__ (line 76) | def __init__(self, fn='depthFirstSearch', prob='PositionSearchProblem'... method registerInitialState (line 103) | def registerInitialState(self, state): method getAction (line 120) | def getAction(self, state): class PositionSearchProblem (line 136) | class PositionSearchProblem(search.SearchProblem): method __init__ (line 147) | def __init__(self, gameState, costFn = lambda x: 1, goal=(1,1), start=... method getStartState (line 167) | def getStartState(self): method isGoalState (line 170) | def isGoalState(self, state): method getSuccessors (line 183) | def getSuccessors(self, state): method getCostOfActions (line 213) | def getCostOfActions(self, actions): class StayEastSearchAgent (line 229) | class StayEastSearchAgent(SearchAgent): method __init__ (line 236) | def __init__(self): class StayWestSearchAgent (line 241) | class StayWestSearchAgent(SearchAgent): method __init__ (line 248) | def __init__(self): function manhattanHeuristic (line 253) | def manhattanHeuristic(position, problem, info={}): function euclideanHeuristic (line 259) | def euclideanHeuristic(position, problem, info={}): class CornersProblem (line 269) | class CornersProblem(search.SearchProblem): method __init__ (line 276) | def __init__(self, startingGameState): method getStartState (line 291) | def getStartState(self): method isGoalState (line 298) | def isGoalState(self, state): method getSuccessors (line 305) | def getSuccessors(self, state): method getCostOfActions (line 331) | def getCostOfActions(self, actions): function cornersHeuristic (line 345) | def cornersHeuristic(state, problem): class AStarCornersAgent (line 378) | class AStarCornersAgent(SearchAgent): method __init__ (line 380) | def __init__(self): class FoodSearchProblem (line 384) | class FoodSearchProblem: method __init__ (line 393) | def __init__(self, startingGameState): method getStartState (line 400) | def getStartState(self): method isGoalState (line 403) | def isGoalState(self, state): method getSuccessors (line 406) | def getSuccessors(self, state): method getCostOfActions (line 420) | def getCostOfActions(self, actions): class AStarFoodSearchAgent (line 434) | class AStarFoodSearchAgent(SearchAgent): method __init__ (line 436) | def __init__(self): function foodHeuristic (line 440) | def foodHeuristic(state, problem): class ClosestDotSearchAgent (line 490) | class ClosestDotSearchAgent(SearchAgent): method registerInitialState (line 492) | def registerInitialState(self, state): method findPathToClosestDot (line 507) | def findPathToClosestDot(self, gameState): class AnyFoodSearchProblem (line 520) | class AnyFoodSearchProblem(PositionSearchProblem): method __init__ (line 535) | def __init__(self, gameState): method isGoalState (line 546) | def isGoalState(self, state): function mazeDistance (line 554) | def mazeDistance(point1, point2, gameState): FILE: Project-1/searchTestClasses.py function wrap_solution (line 25) | def wrap_solution(solution): function followAction (line 34) | def followAction(state, action, problem): function followPath (line 39) | def followPath(path, problem): function checkSolution (line 47) | def checkSolution(problem, path): class GraphSearch (line 54) | class GraphSearch(SearchProblem): method __init__ (line 57) | def __init__(self, graph_text): method getStartState (line 98) | def getStartState(self): method isGoalState (line 102) | def isGoalState(self, state): method getSuccessors (line 106) | def getSuccessors(self, state): method getCostOfActions (line 111) | def getCostOfActions(self, actions): method getExpandedStates (line 128) | def getExpandedStates(self): method __str__ (line 131) | def __str__(self): function parseHeuristic (line 141) | def parseHeuristic(heuristicText): class GraphSearchTest (line 164) | class GraphSearchTest(testClasses.TestCase): method __init__ (line 166) | def __init__(self, question, testDict): method getSolInfo (line 179) | def getSolInfo(self, search): method execute (line 195) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 226) | def writeSolution(self, moduleDict, filePath): class PacmanSearchTest (line 255) | class PacmanSearchTest(testClasses.TestCase): method __init__ (line 257) | def __init__(self, question, testDict): method getSolInfo (line 270) | def getSolInfo(self, search, searchAgents): method execute (line 299) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 340) | def writeSolution(self, moduleDict, filePath): function getStatesFromPath (line 370) | def getStatesFromPath(start, path): class CornerProblemTest (line 381) | class CornerProblemTest(testClasses.TestCase): method __init__ (line 383) | def __init__(self, question, testDict): method solution (line 388) | def solution(self, search, searchAgents): method execute (line 403) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 432) | def writeSolution(self, moduleDict, filePath): class HeuristicTest (line 467) | class HeuristicTest(testClasses.TestCase): method __init__ (line 469) | def __init__(self, question, testDict): method setupProblem (line 476) | def setupProblem(self, searchAgents): method checkHeuristic (line 487) | def checkHeuristic(self, heuristic, problem, state, solutionCost): method execute (line 510) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 526) | def writeSolution(self, moduleDict, filePath): class HeuristicGrade (line 549) | class HeuristicGrade(testClasses.TestCase): method __init__ (line 551) | def __init__(self, question, testDict): method setupProblem (line 560) | def setupProblem(self, searchAgents): method execute (line 572) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 603) | def writeSolution(self, moduleDict, filePath): class ClosestDotTest (line 627) | class ClosestDotTest(testClasses.TestCase): method __init__ (line 629) | def __init__(self, question, testDict): method solution (line 634) | def solution(self, searchAgents): method execute (line 641) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 665) | def writeSolution(self, moduleDict, filePath): class CornerHeuristicSanity (line 685) | class CornerHeuristicSanity(testClasses.TestCase): method __init__ (line 687) | def __init__(self, question, testDict): method execute (line 691) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 740) | def writeSolution(self, moduleDict, filePath): class CornerHeuristicPacman (line 762) | class CornerHeuristicPacman(testClasses.TestCase): method __init__ (line 764) | def __init__(self, question, testDict): method execute (line 768) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 801) | def writeSolution(self, moduleDict, filePath): FILE: Project-1/testClasses.py class Question (line 24) | class Question(object): method raiseNotDefined (line 26) | def raiseNotDefined(self): method __init__ (line 30) | def __init__(self, questionDict, display): method getDisplay (line 35) | def getDisplay(self): method getMaxPoints (line 38) | def getMaxPoints(self): method addTestCase (line 43) | def addTestCase(self, testCase, thunk): method execute (line 46) | def execute(self, grades): class PassAllTestsQuestion (line 50) | class PassAllTestsQuestion(Question): method execute (line 52) | def execute(self, grades): class HackedPartialCreditQuestion (line 67) | class HackedPartialCreditQuestion(Question): method execute (line 69) | def execute(self, grades): class Q6PartialCreditQuestion (line 89) | class Q6PartialCreditQuestion(Question): method execute (line 93) | def execute(self, grades): class PartialCreditQuestion (line 102) | class PartialCreditQuestion(Question): method execute (line 106) | def execute(self, grades): class NumberPassedQuestion (line 117) | class NumberPassedQuestion(Question): method execute (line 120) | def execute(self, grades): class TestCase (line 128) | class TestCase(object): method raiseNotDefined (line 130) | def raiseNotDefined(self): method getPath (line 134) | def getPath(self): method __init__ (line 137) | def __init__(self, question, testDict): method __str__ (line 143) | def __str__(self): method execute (line 146) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 149) | def writeSolution(self, moduleDict, filePath): method testPass (line 159) | def testPass(self, grades): method testFail (line 165) | def testFail(self, grades): method testPartial (line 173) | def testPartial(self, grades, points, maxPoints): method addMessage (line 187) | def addMessage(self, message): FILE: Project-1/testParser.py class TestParser (line 18) | class TestParser(object): method __init__ (line 20) | def __init__(self, path): method removeComments (line 24) | def removeComments(self, rawlines): method parse (line 35) | def parse(self): function emitTestDict (line 76) | def emitTestDict(testDict, handle): FILE: Project-1/textDisplay.py class NullGraphics (line 26) | class NullGraphics: method initialize (line 27) | def initialize(self, state, isBlue = False): method update (line 30) | def update(self, state): method checkNullDisplay (line 33) | def checkNullDisplay(self): method pause (line 36) | def pause(self): method draw (line 39) | def draw(self, state): method updateDistributions (line 42) | def updateDistributions(self, dist): method finish (line 45) | def finish(self): class PacmanGraphics (line 48) | class PacmanGraphics: method __init__ (line 49) | def __init__(self, speed=None): method initialize (line 54) | def initialize(self, state, isBlue = False): method update (line 60) | def update(self, state): method pause (line 74) | def pause(self): method draw (line 77) | def draw(self, state): method finish (line 80) | def finish(self): FILE: Project-1/util.py class FixedRandom (line 21) | class FixedRandom: method __init__ (line 22) | def __init__(self): class Stack (line 120) | class Stack: method __init__ (line 122) | def __init__(self): method push (line 125) | def push(self,item): method pop (line 129) | def pop(self): method isEmpty (line 133) | def isEmpty(self): class Queue (line 137) | class Queue: method __init__ (line 139) | def __init__(self): method push (line 142) | def push(self,item): method pop (line 146) | def pop(self): method isEmpty (line 153) | def isEmpty(self): class PriorityQueue (line 157) | class PriorityQueue: method __init__ (line 168) | def __init__(self): method push (line 172) | def push(self, item, priority): method pop (line 180) | def pop(self): method isEmpty (line 185) | def isEmpty(self): class PriorityQueueWithFunction (line 188) | class PriorityQueueWithFunction(PriorityQueue): method __init__ (line 195) | def __init__(self, priorityFunction): method push (line 200) | def push(self, item): function manhattanDistance (line 205) | def manhattanDistance( xy1, xy2 ): class Counter (line 215) | class Counter(dict): method __getitem__ (line 255) | def __getitem__(self, idx): method incrementAll (line 259) | def incrementAll(self, keys, count): method argMax (line 273) | def argMax(self): method sortedKeys (line 283) | def sortedKeys(self): method totalCount (line 300) | def totalCount(self): method normalize (line 306) | def normalize(self): method divideAll (line 318) | def divideAll(self, divisor): method copy (line 326) | def copy(self): method __mul__ (line 332) | def __mul__(self, y ): method __radd__ (line 358) | def __radd__(self, y): method __add__ (line 376) | def __add__( self, y ): method __sub__ (line 402) | def __sub__( self, y ): function raiseNotDefined (line 428) | def raiseNotDefined(): function normalize (line 436) | def normalize(vectorOrCounter): function nSample (line 455) | def nSample(distribution, values, n): function sample (line 471) | def sample(distribution, values = None): function sampleFromCounter (line 485) | def sampleFromCounter(ctr): function getProbability (line 489) | def getProbability(value, distribution, values): function flipCoin (line 500) | def flipCoin( p ): function chooseFromDistribution (line 504) | def chooseFromDistribution( distribution ): function nearestPoint (line 514) | def nearestPoint( pos ): function sign (line 524) | def sign( x ): function arrayInvert (line 533) | def arrayInvert(array): function matrixAsList (line 543) | def matrixAsList( matrix, value = True ): function lookup (line 555) | def lookup(name, namespace): function pause (line 573) | def pause(): class TimeoutFunctionException (line 591) | class TimeoutFunctionException(Exception): class TimeoutFunction (line 596) | class TimeoutFunction: method __init__ (line 597) | def __init__(self, function, timeout): method handle_timeout (line 601) | def handle_timeout(self, signum, frame): method __call__ (line 604) | def __call__(self, *args, **keyArgs): class WritableNull (line 630) | class WritableNull: method write (line 631) | def write(self, string): function mutePrint (line 634) | def mutePrint(): function unmutePrint (line 645) | def unmutePrint(): FILE: Project-2/autograder.py function readCommand (line 31) | def readCommand(argv): function confirmGenerate (line 83) | def confirmGenerate(): function setModuleName (line 100) | def setModuleName(module, filename): function loadModuleString (line 118) | def loadModuleString(moduleSource): function loadModuleFile (line 131) | def loadModuleFile(moduleName, filePath): function readFile (line 136) | def readFile(path, root=""): function splitStrings (line 173) | def splitStrings(d): function printTest (line 184) | def printTest(testDict, solutionDict): function runTest (line 194) | def runTest(testName, moduleDict, printTestCase=False, display=None): function getDepends (line 219) | def getDepends(testParser, testRoot, question): function getTestSubdirs (line 230) | def getTestSubdirs(testParser, testRoot, questionToGrade): function evaluate (line 243) | def evaluate(generateSolutions, testRoot, moduleDict, exceptionMap=ERROR... function getDisplay (line 310) | def getDisplay(graphicsByDefault, options=None): FILE: Project-2/game.py class Agent (line 32) | class Agent: method __init__ (line 39) | def __init__(self, index=0): method getAction (line 42) | def getAction(self, state): class Directions (line 49) | class Directions: class Configuration (line 70) | class Configuration: method __init__ (line 79) | def __init__(self, pos, direction): method getPosition (line 83) | def getPosition(self): method getDirection (line 86) | def getDirection(self): method isInteger (line 89) | def isInteger(self): method __eq__ (line 93) | def __eq__(self, other): method __hash__ (line 97) | def __hash__(self): method __str__ (line 102) | def __str__(self): method generateSuccessor (line 105) | def generateSuccessor(self, vector): class AgentState (line 120) | class AgentState: method __init__ (line 125) | def __init__( self, startConfiguration, isPacman ): method __str__ (line 133) | def __str__( self ): method __eq__ (line 139) | def __eq__( self, other ): method __hash__ (line 144) | def __hash__(self): method copy (line 147) | def copy( self ): method getPosition (line 155) | def getPosition(self): method getDirection (line 159) | def getDirection(self): class Grid (line 162) | class Grid: method __init__ (line 170) | def __init__(self, width, height, initialValue=False, bitRepresentatio... method __getitem__ (line 180) | def __getitem__(self, i): method __setitem__ (line 183) | def __setitem__(self, key, item): method __str__ (line 186) | def __str__(self): method __eq__ (line 191) | def __eq__(self, other): method __hash__ (line 195) | def __hash__(self): method copy (line 206) | def copy(self): method deepCopy (line 211) | def deepCopy(self): method shallowCopy (line 214) | def shallowCopy(self): method count (line 219) | def count(self, item =True ): method asList (line 222) | def asList(self, key = True): method packBits (line 229) | def packBits(self): method _cellIndexToPosition (line 248) | def _cellIndexToPosition(self, index): method _unpackBits (line 253) | def _unpackBits(self, bits): method _unpackInt (line 265) | def _unpackInt(self, packed, size): function reconstituteGrid (line 277) | def reconstituteGrid(bitRep): class Actions (line 287) | class Actions: method reverseDirection (line 302) | def reverseDirection(action): method vectorToDirection (line 314) | def vectorToDirection(vector): method directionToVector (line 327) | def directionToVector(direction, speed = 1.0): method getPossibleActions (line 332) | def getPossibleActions(config, walls): method getLegalNeighbors (line 351) | def getLegalNeighbors(position, walls): method getSuccessor (line 365) | def getSuccessor(position, action): class GameStateData (line 371) | class GameStateData: method __init__ (line 375) | def __init__( self, prevState = None ): method deepCopy (line 395) | def deepCopy( self ): method copyAgentStates (line 405) | def copyAgentStates( self, agentStates ): method __eq__ (line 411) | def __eq__( self, other ): method __hash__ (line 423) | def __hash__( self ): method __str__ (line 435) | def __str__( self ): method _foodWallStr (line 460) | def _foodWallStr( self, hasFood, hasWall ): method _pacStr (line 468) | def _pacStr( self, dir ): method _ghostStr (line 477) | def _ghostStr( self, dir ): method initialize (line 487) | def initialize( self, layout, numGhostAgents ): class Game (line 513) | class Game: method __init__ (line 518) | def __init__( self, agents, display, rules, startingIndex=0, muteAgent... method getProgress (line 534) | def getProgress(self): method _agentCrash (line 540) | def _agentCrash( self, agentIndex, quiet=False): method mute (line 550) | def mute(self, agentIndex): method unmute (line 559) | def unmute(self): method run (line 567) | def run( self ): FILE: Project-2/ghostAgents.py class GhostAgent (line 22) | class GhostAgent( Agent ): method __init__ (line 23) | def __init__( self, index ): method getAction (line 26) | def getAction( self, state ): method getDistribution (line 33) | def getDistribution(self, state): class RandomGhost (line 37) | class RandomGhost( GhostAgent ): method getDistribution (line 39) | def getDistribution( self, state ): class DirectionalGhost (line 45) | class DirectionalGhost( GhostAgent ): method __init__ (line 47) | def __init__( self, index, prob_attack=0.8, prob_scaredFlee=0.8 ): method getDistribution (line 52) | def getDistribution( self, state ): FILE: Project-2/grading.py class Grades (line 25) | class Grades: method __init__ (line 27) | def __init__(self, projectName, questionsAndMaxesList, edxOutput=False... method addPrereq (line 48) | def addPrereq(self, question, prereq): method grade (line 51) | def grade(self, gradingModule, exceptionMap = {}, bonusPic = False): method addExceptionMessage (line 139) | def addExceptionMessage(self, q, inst, traceback): method addErrorHints (line 149) | def addErrorHints(self, exceptionMap, errorInstance, questionNum): method produceOutput (line 171) | def produceOutput(self): method fail (line 227) | def fail(self, message, raw=False): method assignZeroCredit (line 233) | def assignZeroCredit(self): method addPoints (line 236) | def addPoints(self, amt): method deductPoints (line 239) | def deductPoints(self, amt): method assignFullCredit (line 242) | def assignFullCredit(self, message="", raw=False): method addMessage (line 247) | def addMessage(self, message, raw=False): method addMessageToEmail (line 256) | def addMessageToEmail(self, message): class Counter (line 267) | class Counter(dict): method __getitem__ (line 271) | def __getitem__(self, idx): method totalCount (line 277) | def totalCount(self): FILE: Project-2/graphicsDisplay.py class InfoPane (line 82) | class InfoPane: method __init__ (line 83) | def __init__(self, layout, gridSize): method toScreen (line 92) | def toScreen(self, pos, y = None): method drawPane (line 105) | def drawPane(self): method initializeGhostDistances (line 108) | def initializeGhostDistances(self, distances): method updateScore (line 121) | def updateScore(self, score): method setTeam (line 124) | def setTeam(self, isBlue): method updateGhostDistances (line 129) | def updateGhostDistances(self, distances): method drawGhost (line 136) | def drawGhost(self): method drawPacman (line 139) | def drawPacman(self): method drawWarning (line 142) | def drawWarning(self): method clearIcon (line 145) | def clearIcon(self): method updateMessage (line 148) | def updateMessage(self, message): method clearMessage (line 151) | def clearMessage(self): class PacmanGraphics (line 155) | class PacmanGraphics: method __init__ (line 156) | def __init__(self, zoom=1.0, frameTime=0.0, capture=False): method checkNullDisplay (line 165) | def checkNullDisplay(self): method initialize (line 168) | def initialize(self, state, isBlue = False): method startGraphics (line 180) | def startGraphics(self, state): method drawDistributions (line 189) | def drawDistributions(self, state): method drawStaticObjects (line 204) | def drawStaticObjects(self, state): method drawAgentObjects (line 211) | def drawAgentObjects(self, state): method swapImages (line 222) | def swapImages(self, agentIndex, newState): method update (line 236) | def update(self, newState): method make_window (line 256) | def make_window(self, width, height): method drawPacman (line 267) | def drawPacman(self, pacman, index): method getEndpoints (line 286) | def getEndpoints(self, direction, position=(0,0)): method movePacman (line 302) | def movePacman(self, position, direction, image): method animatePacman (line 309) | def animatePacman(self, pacman, prevPacman, image): method getGhostColor (line 329) | def getGhostColor(self, ghost, ghostIndex): method drawGhost (line 335) | def drawGhost(self, ghost, agentIndex): method moveEyes (line 371) | def moveEyes(self, pos, dir, eyes): method moveGhost (line 388) | def moveGhost(self, ghost, ghostIndex, prevGhost, ghostImageParts): method getPosition (line 405) | def getPosition(self, agentState): method getDirection (line 409) | def getDirection(self, agentState): method finish (line 413) | def finish(self): method to_screen (line 416) | def to_screen(self, point): method to_screen2 (line 424) | def to_screen2(self, point): method drawWalls (line 431) | def drawWalls(self, wallMatrix): method isWall (line 517) | def isWall(self, x, y, walls): method drawFood (line 524) | def drawFood(self, foodMatrix ): method drawCapsules (line 544) | def drawCapsules(self, capsules ): method removeFood (line 556) | def removeFood(self, cell, foodImages ): method removeCapsule (line 560) | def removeCapsule(self, cell, capsuleImages ): method drawExpandedCells (line 564) | def drawExpandedCells(self, cells): method clearExpandedCells (line 583) | def clearExpandedCells(self): method updateDistributions (line 589) | def updateDistributions(self, distributions): class FirstPersonPacmanGraphics (line 611) | class FirstPersonPacmanGraphics(PacmanGraphics): method __init__ (line 612) | def __init__(self, zoom = 1.0, showGhosts = True, capture = False, fra... method initialize (line 617) | def initialize(self, state, isBlue = False): method lookAhead (line 634) | def lookAhead(self, config, state): method getGhostColor (line 648) | def getGhostColor(self, ghost, ghostIndex): method getPosition (line 651) | def getPosition(self, ghostState): function add (line 657) | def add(x, y): function saveFrame (line 672) | def saveFrame(): FILE: Project-2/graphicsUtils.py function formatColor (line 35) | def formatColor(r, g, b): function colorToVector (line 38) | def colorToVector(color): function sleep (line 47) | def sleep(secs): function begin_graphics (line 56) | def begin_graphics(width=640, height=480, color=formatColor(0, 0, 0), ti... function _leftclick (line 101) | def _leftclick(event): function _rightclick (line 105) | def _rightclick(event): function _ctrl_leftclick (line 109) | def _ctrl_leftclick(event): function wait_for_click (line 113) | def wait_for_click(): function draw_background (line 132) | def draw_background(): function _destroy_window (line 136) | def _destroy_window(event=None): function end_graphics (line 143) | def end_graphics(): function clear_screen (line 158) | def clear_screen(background=None): function polygon (line 164) | def polygon(coords, outlineColor, fillColor=None, filled=1, smoothed=1, ... function square (line 176) | def square(pos, r, color, filled=1, behind=0): function circle (line 181) | def circle(pos, r, outlineColor, fillColor, endpoints=None, style='piesl... function image (line 194) | def image(pos, file="../../blueghost.gif"): function refresh (line 200) | def refresh(): function moveCircle (line 203) | def moveCircle(id, pos, r, endpoints=None): function edit (line 220) | def edit(id, *args): function text (line 223) | def text(pos, color, contents, font='Helvetica', size=12, style='normal'... function changeText (line 229) | def changeText(id, newText, font=None, size=12, style='normal'): function changeColor (line 234) | def changeColor(id, newColor): function line (line 237) | def line(here, there, color=formatColor(0, 0, 0), width=2): function _keypress (line 254) | def _keypress(event): function _keyrelease (line 262) | def _keyrelease(event): function remap_arrows (line 271) | def remap_arrows(event): function _clear_keys (line 284) | def _clear_keys(event=None): function keys_pressed (line 290) | def keys_pressed(d_o_e=Tkinter.tkinter.dooneevent, function keys_waiting (line 297) | def keys_waiting(): function wait_for_keys (line 305) | def wait_for_keys(): function remove_from_screen (line 312) | def remove_from_screen(x, function _adjust_coords (line 318) | def _adjust_coords(coord_list, x, y): function move_to (line 324) | def move_to(object, x, y=None, function move_by (line 346) | def move_by(object, x, y=None, function writePostscript (line 369) | def writePostscript(filename): FILE: Project-2/keyboardAgents.py class KeyboardAgent (line 19) | class KeyboardAgent(Agent): method __init__ (line 30) | def __init__( self, index = 0 ): method getAction (line 36) | def getAction( self, state): method getMove (line 59) | def getMove(self, legal): class KeyboardAgent2 (line 67) | class KeyboardAgent2(KeyboardAgent): method getMove (line 78) | def getMove(self, legal): FILE: Project-2/layout.py class Layout (line 22) | class Layout: method __init__ (line 27) | def __init__(self, layoutText): method getNumGhosts (line 40) | def getNumGhosts(self): method initializeVisibilityMatrix (line 43) | def initializeVisibilityMatrix(self): method isWall (line 64) | def isWall(self, pos): method getRandomLegalPosition (line 68) | def getRandomLegalPosition(self): method getRandomCorner (line 76) | def getRandomCorner(self): method getFurthestCorner (line 80) | def getFurthestCorner(self, pacPos): method isVisibleFrom (line 85) | def isVisibleFrom(self, ghostPos, pacPos, pacDirection): method __str__ (line 89) | def __str__(self): method deepCopy (line 92) | def deepCopy(self): method processLayoutText (line 95) | def processLayoutText(self, layoutText): method processLayoutChar (line 116) | def processLayoutChar(self, x, y, layoutChar): function getLayout (line 131) | def getLayout(name, back = 2): function tryToLoad (line 145) | def tryToLoad(fullname): FILE: Project-2/multiAgents.py class ReflexAgent (line 21) | class ReflexAgent(Agent): method getAction (line 32) | def getAction(self, gameState): method evaluationFunction (line 54) | def evaluationFunction(self, currentGameState, action): function scoreEvaluationFunction (line 93) | def scoreEvaluationFunction(currentGameState): class MultiAgentSearchAgent (line 103) | class MultiAgentSearchAgent(Agent): method __init__ (line 118) | def __init__(self, evalFn = 'scoreEvaluationFunction', depth = '2'): class MinimaxAgent (line 123) | class MinimaxAgent(MultiAgentSearchAgent): method getAction (line 128) | def getAction(self, gameState): method getValue (line 156) | def getValue(self, gameState, currentDepth, agentIndex): method maxValue (line 164) | def maxValue(self, gameState, currentDepth): method minValue (line 170) | def minValue(self, gameState, currentDepth, agentIndex): class AlphaBetaAgent (line 179) | class AlphaBetaAgent(MultiAgentSearchAgent): method getAction (line 184) | def getAction(self, gameState): method getValue (line 202) | def getValue(self, gameState, currentDepth, agentIndex, alpha, beta): method maxValue (line 210) | def maxValue(self, gameState, currentDepth, alpha, beta): method minValue (line 219) | def minValue(self, gameState, currentDepth, agentIndex, alpha, beta): class ExpectimaxAgent (line 231) | class ExpectimaxAgent(MultiAgentSearchAgent): method getAction (line 236) | def getAction(self, gameState): method getValue (line 253) | def getValue(self, gameState, currentDepth, agentIndex): method maxValue (line 261) | def maxValue(self, gameState, currentDepth): method avgValue (line 267) | def avgValue(self, gameState, currentDepth, agentIndex): function betterEvaluationFunction (line 276) | def betterEvaluationFunction(currentGameState): FILE: Project-2/multiagentTestClasses.py class MultiagentTreeState (line 40) | class MultiagentTreeState(object): method __init__ (line 41) | def __init__(self, problem, state): method generateSuccessor (line 45) | def generateSuccessor(self, agentIndex, action): method getScore (line 52) | def getScore(self): method getLegalActions (line 59) | def getLegalActions(self, agentIndex=0): method isWin (line 66) | def isWin(self): method isLose (line 71) | def isLose(self): method getNumAgents (line 76) | def getNumAgents(self): class MultiagentTreeProblem (line 82) | class MultiagentTreeProblem(object): method __init__ (line 83) | def __init__(self, numAgents, startState, winStates, loseStates, succe... method reset (line 100) | def reset(self): function parseTreeProblem (line 104) | def parseTreeProblem(testDict): function run (line 132) | def run(lay, layName, pac, ghosts, disp, nGames=1, name='games'): class GradingAgent (line 145) | class GradingAgent(Agent): method __init__ (line 146) | def __init__(self, seed, studentAgent, optimalActions, altDepthActions... method registerInitialState (line 163) | def registerInitialState(self, state): method getAction (line 168) | def getAction(self, state): method getSuboptimalMoves (line 197) | def getSuboptimalMoves(self): method getWrongStatesExplored (line 200) | def getWrongStatesExplored(self): method checkFailure (line 203) | def checkFailure(self): class PolyAgent (line 221) | class PolyAgent(Agent): method __init__ (line 222) | def __init__(self, seed, multiAgents, ourPacOptions, depth): method select (line 243) | def select(self, list, indices): method construct_our_pacs (line 249) | def construct_our_pacs(self, multiAgents, keyword_dict): method registerInitialState (line 263) | def registerInitialState(self, state): method getAction (line 269) | def getAction(self, state): method getTraces (line 285) | def getTraces(self): class PacmanGameTreeTest (line 289) | class PacmanGameTreeTest(testClasses.TestCase): method __init__ (line 291) | def __init__(self, question, testDict): method execute (line 300) | def execute(self, grades, moduleDict, solutionDict): method writeList (line 342) | def writeList(self, handle, name, list): method writeSolution (line 348) | def writeSolution(self, moduleDict, filePath): class GraphGameTreeTest (line 372) | class GraphGameTreeTest(testClasses.TestCase): method __init__ (line 374) | def __init__(self, question, testDict): method solveProblem (line 381) | def solveProblem(self, multiAgents): method addDiagram (line 388) | def addDiagram(self): method execute (line 393) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 416) | def writeSolution(self, moduleDict, filePath): class EvalAgentTest (line 430) | class EvalAgentTest(testClasses.TestCase): method __init__ (line 432) | def __init__(self, question, testDict): method execute (line 453) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 520) | def writeSolution(self, moduleDict, filePath): FILE: Project-2/pacman.py class GameState (line 55) | class GameState: method getAndResetExplored (line 76) | def getAndResetExplored(): method getLegalActions (line 82) | def getLegalActions( self, agentIndex=0 ): method generateSuccessor (line 94) | def generateSuccessor( self, agentIndex, action): method getLegalPacmanActions (line 127) | def getLegalPacmanActions( self ): method generatePacmanSuccessor (line 130) | def generatePacmanSuccessor( self, action ): method getPacmanState (line 136) | def getPacmanState( self ): method getPacmanPosition (line 145) | def getPacmanPosition( self ): method getGhostStates (line 148) | def getGhostStates( self ): method getGhostState (line 151) | def getGhostState( self, agentIndex ): method getGhostPosition (line 156) | def getGhostPosition( self, agentIndex ): method getGhostPositions (line 161) | def getGhostPositions(self): method getNumAgents (line 164) | def getNumAgents( self ): method getScore (line 167) | def getScore( self ): method getCapsules (line 170) | def getCapsules(self): method getNumFood (line 176) | def getNumFood( self ): method getFood (line 179) | def getFood(self): method getWalls (line 191) | def getWalls(self): method hasFood (line 203) | def hasFood(self, x, y): method hasWall (line 206) | def hasWall(self, x, y): method isLose (line 209) | def isLose( self ): method isWin (line 212) | def isWin( self ): method __init__ (line 220) | def __init__( self, prevState = None ): method deepCopy (line 229) | def deepCopy( self ): method __eq__ (line 234) | def __eq__( self, other ): method __hash__ (line 240) | def __hash__( self ): method __str__ (line 246) | def __str__( self ): method initialize (line 250) | def initialize( self, layout, numGhostAgents=1000 ): class ClassicGameRules (line 266) | class ClassicGameRules: method __init__ (line 271) | def __init__(self, timeout=30): method newGame (line 274) | def newGame( self, layout, pacmanAgent, ghostAgents, display, quiet = ... method process (line 284) | def process(self, state, game): method win (line 291) | def win( self, state, game ): method lose (line 295) | def lose( self, state, game ): method getProgress (line 299) | def getProgress(self, game): method agentCrash (line 302) | def agentCrash(self, game, agentIndex): method getMaxTotalTime (line 308) | def getMaxTotalTime(self, agentIndex): method getMaxStartupTime (line 311) | def getMaxStartupTime(self, agentIndex): method getMoveWarningTime (line 314) | def getMoveWarningTime(self, agentIndex): method getMoveTimeout (line 317) | def getMoveTimeout(self, agentIndex): method getMaxTimeWarnings (line 320) | def getMaxTimeWarnings(self, agentIndex): class PacmanRules (line 323) | class PacmanRules: method getLegalActions (line 330) | def getLegalActions( state ): method applyAction (line 337) | def applyAction( state, action ): method consume (line 359) | def consume( position, state ): class GhostRules (line 381) | class GhostRules: method getLegalActions (line 386) | def getLegalActions( state, ghostIndex ): method applyAction (line 401) | def applyAction( state, action, ghostIndex): method decrementTimer (line 414) | def decrementTimer( ghostState): method checkDeath (line 421) | def checkDeath( state, agentIndex): method collide (line 436) | def collide( state, ghostState, agentIndex): method canKill (line 449) | def canKill( pacmanPosition, ghostPosition ): method placeGhost (line 453) | def placeGhost(state, ghostState): function default (line 461) | def default(str): function parseAgentArgs (line 464) | def parseAgentArgs(str): function readCommand (line 476) | def readCommand( argv ): function loadAgent (line 587) | def loadAgent(pacman, nographics): function replayGame (line 610) | def replayGame( layout, actions, display ): function runGames (line 628) | def runGames( layout, pacman, ghosts, display, numGames, record, numTrai... FILE: Project-2/pacmanAgents.py class LeftTurnAgent (line 21) | class LeftTurnAgent(game.Agent): method getAction (line 24) | def getAction(self, state): class GreedyAgent (line 35) | class GreedyAgent(Agent): method __init__ (line 36) | def __init__(self, evalFn="scoreEvaluation"): method getAction (line 40) | def getAction(self, state): function scoreEvaluation (line 51) | def scoreEvaluation(state): FILE: Project-2/testClasses.py class Question (line 24) | class Question(object): method raiseNotDefined (line 26) | def raiseNotDefined(self): method __init__ (line 30) | def __init__(self, questionDict, display): method getDisplay (line 35) | def getDisplay(self): method getMaxPoints (line 38) | def getMaxPoints(self): method addTestCase (line 43) | def addTestCase(self, testCase, thunk): method execute (line 46) | def execute(self, grades): class PassAllTestsQuestion (line 50) | class PassAllTestsQuestion(Question): method execute (line 52) | def execute(self, grades): class HackedPartialCreditQuestion (line 67) | class HackedPartialCreditQuestion(Question): method execute (line 69) | def execute(self, grades): class Q6PartialCreditQuestion (line 89) | class Q6PartialCreditQuestion(Question): method execute (line 93) | def execute(self, grades): class PartialCreditQuestion (line 102) | class PartialCreditQuestion(Question): method execute (line 106) | def execute(self, grades): class NumberPassedQuestion (line 117) | class NumberPassedQuestion(Question): method execute (line 120) | def execute(self, grades): class TestCase (line 128) | class TestCase(object): method raiseNotDefined (line 130) | def raiseNotDefined(self): method getPath (line 134) | def getPath(self): method __init__ (line 137) | def __init__(self, question, testDict): method __str__ (line 143) | def __str__(self): method execute (line 146) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 149) | def writeSolution(self, moduleDict, filePath): method testPass (line 159) | def testPass(self, grades): method testFail (line 165) | def testFail(self, grades): method testPartial (line 173) | def testPartial(self, grades, points, maxPoints): method addMessage (line 187) | def addMessage(self, message): FILE: Project-2/testParser.py class TestParser (line 18) | class TestParser(object): method __init__ (line 20) | def __init__(self, path): method removeComments (line 24) | def removeComments(self, rawlines): method parse (line 35) | def parse(self): function emitTestDict (line 76) | def emitTestDict(testDict, handle): FILE: Project-2/textDisplay.py class NullGraphics (line 26) | class NullGraphics: method initialize (line 27) | def initialize(self, state, isBlue = False): method update (line 30) | def update(self, state): method checkNullDisplay (line 33) | def checkNullDisplay(self): method pause (line 36) | def pause(self): method draw (line 39) | def draw(self, state): method updateDistributions (line 42) | def updateDistributions(self, dist): method finish (line 45) | def finish(self): class PacmanGraphics (line 48) | class PacmanGraphics: method __init__ (line 49) | def __init__(self, speed=None): method initialize (line 54) | def initialize(self, state, isBlue = False): method update (line 60) | def update(self, state): method pause (line 74) | def pause(self): method draw (line 77) | def draw(self, state): method finish (line 80) | def finish(self): FILE: Project-2/util.py class FixedRandom (line 21) | class FixedRandom: method __init__ (line 22) | def __init__(self): class Stack (line 120) | class Stack: method __init__ (line 122) | def __init__(self): method push (line 125) | def push(self,item): method pop (line 129) | def pop(self): method isEmpty (line 133) | def isEmpty(self): class Queue (line 137) | class Queue: method __init__ (line 139) | def __init__(self): method push (line 142) | def push(self,item): method pop (line 146) | def pop(self): method isEmpty (line 153) | def isEmpty(self): class PriorityQueue (line 157) | class PriorityQueue: method __init__ (line 168) | def __init__(self): method push (line 172) | def push(self, item, priority): method pop (line 180) | def pop(self): method isEmpty (line 185) | def isEmpty(self): class PriorityQueueWithFunction (line 188) | class PriorityQueueWithFunction(PriorityQueue): method __init__ (line 195) | def __init__(self, priorityFunction): method push (line 200) | def push(self, item): function manhattanDistance (line 205) | def manhattanDistance( xy1, xy2 ): class Counter (line 215) | class Counter(dict): method __getitem__ (line 255) | def __getitem__(self, idx): method incrementAll (line 259) | def incrementAll(self, keys, count): method argMax (line 273) | def argMax(self): method sortedKeys (line 283) | def sortedKeys(self): method totalCount (line 300) | def totalCount(self): method normalize (line 306) | def normalize(self): method divideAll (line 318) | def divideAll(self, divisor): method copy (line 326) | def copy(self): method __mul__ (line 332) | def __mul__(self, y ): method __radd__ (line 358) | def __radd__(self, y): method __add__ (line 376) | def __add__( self, y ): method __sub__ (line 402) | def __sub__( self, y ): function raiseNotDefined (line 428) | def raiseNotDefined(): function normalize (line 436) | def normalize(vectorOrCounter): function nSample (line 455) | def nSample(distribution, values, n): function sample (line 471) | def sample(distribution, values = None): function sampleFromCounter (line 485) | def sampleFromCounter(ctr): function getProbability (line 489) | def getProbability(value, distribution, values): function flipCoin (line 500) | def flipCoin( p ): function chooseFromDistribution (line 504) | def chooseFromDistribution( distribution ): function nearestPoint (line 514) | def nearestPoint( pos ): function sign (line 524) | def sign( x ): function arrayInvert (line 533) | def arrayInvert(array): function matrixAsList (line 543) | def matrixAsList( matrix, value = True ): function lookup (line 555) | def lookup(name, namespace): function pause (line 573) | def pause(): class TimeoutFunctionException (line 591) | class TimeoutFunctionException(Exception): class TimeoutFunction (line 596) | class TimeoutFunction: method __init__ (line 597) | def __init__(self, function, timeout): method handle_timeout (line 601) | def handle_timeout(self, signum, frame): method __call__ (line 604) | def __call__(self, *args, **keyArgs): class WritableNull (line 630) | class WritableNull: method write (line 631) | def write(self, string): function mutePrint (line 634) | def mutePrint(): function unmutePrint (line 645) | def unmutePrint(): FILE: Project-3/analysis.py function question2 (line 22) | def question2(): function question3a (line 27) | def question3a(): function question3b (line 33) | def question3b(): function question3c (line 39) | def question3c(): function question3d (line 45) | def question3d(): function question3e (line 51) | def question3e(): function question6 (line 57) | def question6(): FILE: Project-3/autograder.py function readCommand (line 31) | def readCommand(argv): function confirmGenerate (line 83) | def confirmGenerate(): function setModuleName (line 100) | def setModuleName(module, filename): function loadModuleString (line 118) | def loadModuleString(moduleSource): function loadModuleFile (line 131) | def loadModuleFile(moduleName, filePath): function readFile (line 136) | def readFile(path, root=""): function splitStrings (line 173) | def splitStrings(d): function printTest (line 184) | def printTest(testDict, solutionDict): function runTest (line 194) | def runTest(testName, moduleDict, printTestCase=False, display=None): function getDepends (line 219) | def getDepends(testParser, testRoot, question): function getTestSubdirs (line 230) | def getTestSubdirs(testParser, testRoot, questionToGrade): function evaluate (line 243) | def evaluate(generateSolutions, testRoot, moduleDict, exceptionMap=ERROR... function getDisplay (line 310) | def getDisplay(graphicsByDefault, options=None): FILE: Project-3/crawler.py class CrawlingRobotEnvironment (line 22) | class CrawlingRobotEnvironment(environment.Environment): method __init__ (line 24) | def __init__(self, crawlingRobot): method getCurrentState (line 50) | def getCurrentState(self): method getPossibleActions (line 57) | def getPossibleActions(self, state): method doAction (line 74) | def doAction(self, action): method reset (line 117) | def reset(self): class CrawlingRobot (line 136) | class CrawlingRobot: method setAngles (line 138) | def setAngles(self, armAngle, handAngle): method getAngles (line 146) | def getAngles(self): method getRobotPosition (line 152) | def getRobotPosition(self): method moveArm (line 160) | def moveArm(self, newArmAngle): method moveHand (line 182) | def moveHand(self, newHandAngle): method getMinAndMaxArmAngles (line 204) | def getMinAndMaxArmAngles(self): method getMinAndMaxHandAngles (line 211) | def getMinAndMaxHandAngles(self): method getRotationAngle (line 218) | def getRotationAngle(self): method __getCosAndSin (line 235) | def __getCosAndSin(self, angle): method displacement (line 238) | def displacement(self, oldArmDegree, oldHandDegree, armDegree, handDeg... method draw (line 262) | def draw(self, stepCount, stepDelay): method __init__ (line 334) | def __init__(self, canvas): FILE: Project-3/environment.py class Environment (line 17) | class Environment: method getCurrentState (line 19) | def getCurrentState(self): method getPossibleActions (line 25) | def getPossibleActions(self, state): method doAction (line 34) | def doAction(self, action): method reset (line 43) | def reset(self): method isTerminal (line 49) | def isTerminal(self): FILE: Project-3/featureExtractors.py class FeatureExtractor (line 20) | class FeatureExtractor: method getFeatures (line 21) | def getFeatures(self, state, action): class IdentityExtractor (line 29) | class IdentityExtractor(FeatureExtractor): method getFeatures (line 30) | def getFeatures(self, state, action): class CoordinateExtractor (line 35) | class CoordinateExtractor(FeatureExtractor): method getFeatures (line 36) | def getFeatures(self, state, action): function closestFood (line 44) | def closestFood(pos, food, walls): class SimpleExtractor (line 66) | class SimpleExtractor(FeatureExtractor): method getFeatures (line 75) | def getFeatures(self, state, action): FILE: Project-3/game.py class Agent (line 32) | class Agent: method __init__ (line 39) | def __init__(self, index=0): method getAction (line 42) | def getAction(self, state): class Directions (line 49) | class Directions: class Configuration (line 70) | class Configuration: method __init__ (line 79) | def __init__(self, pos, direction): method getPosition (line 83) | def getPosition(self): method getDirection (line 86) | def getDirection(self): method isInteger (line 89) | def isInteger(self): method __eq__ (line 93) | def __eq__(self, other): method __hash__ (line 97) | def __hash__(self): method __str__ (line 102) | def __str__(self): method generateSuccessor (line 105) | def generateSuccessor(self, vector): class AgentState (line 120) | class AgentState: method __init__ (line 125) | def __init__( self, startConfiguration, isPacman ): method __str__ (line 133) | def __str__( self ): method __eq__ (line 139) | def __eq__( self, other ): method __hash__ (line 144) | def __hash__(self): method copy (line 147) | def copy( self ): method getPosition (line 155) | def getPosition(self): method getDirection (line 159) | def getDirection(self): class Grid (line 162) | class Grid: method __init__ (line 170) | def __init__(self, width, height, initialValue=False, bitRepresentatio... method __getitem__ (line 180) | def __getitem__(self, i): method __setitem__ (line 183) | def __setitem__(self, key, item): method __str__ (line 186) | def __str__(self): method __eq__ (line 191) | def __eq__(self, other): method __hash__ (line 195) | def __hash__(self): method copy (line 206) | def copy(self): method deepCopy (line 211) | def deepCopy(self): method shallowCopy (line 214) | def shallowCopy(self): method count (line 219) | def count(self, item =True ): method asList (line 222) | def asList(self, key = True): method packBits (line 229) | def packBits(self): method _cellIndexToPosition (line 248) | def _cellIndexToPosition(self, index): method _unpackBits (line 253) | def _unpackBits(self, bits): method _unpackInt (line 265) | def _unpackInt(self, packed, size): function reconstituteGrid (line 277) | def reconstituteGrid(bitRep): class Actions (line 287) | class Actions: method reverseDirection (line 302) | def reverseDirection(action): method vectorToDirection (line 314) | def vectorToDirection(vector): method directionToVector (line 327) | def directionToVector(direction, speed = 1.0): method getPossibleActions (line 332) | def getPossibleActions(config, walls): method getLegalNeighbors (line 351) | def getLegalNeighbors(position, walls): method getSuccessor (line 365) | def getSuccessor(position, action): class GameStateData (line 371) | class GameStateData: method __init__ (line 375) | def __init__( self, prevState = None ): method deepCopy (line 395) | def deepCopy( self ): method copyAgentStates (line 405) | def copyAgentStates( self, agentStates ): method __eq__ (line 411) | def __eq__( self, other ): method __hash__ (line 423) | def __hash__( self ): method __str__ (line 435) | def __str__( self ): method _foodWallStr (line 460) | def _foodWallStr( self, hasFood, hasWall ): method _pacStr (line 468) | def _pacStr( self, dir ): method _ghostStr (line 477) | def _ghostStr( self, dir ): method initialize (line 487) | def initialize( self, layout, numGhostAgents ): class Game (line 513) | class Game: method __init__ (line 518) | def __init__( self, agents, display, rules, startingIndex=0, muteAgent... method getProgress (line 534) | def getProgress(self): method _agentCrash (line 540) | def _agentCrash( self, agentIndex, quiet=False): method mute (line 550) | def mute(self, agentIndex): method unmute (line 559) | def unmute(self): method run (line 567) | def run( self ): FILE: Project-3/ghostAgents.py class GhostAgent (line 22) | class GhostAgent( Agent ): method __init__ (line 23) | def __init__( self, index ): method getAction (line 26) | def getAction( self, state ): method getDistribution (line 33) | def getDistribution(self, state): class RandomGhost (line 37) | class RandomGhost( GhostAgent ): method getDistribution (line 39) | def getDistribution( self, state ): class DirectionalGhost (line 45) | class DirectionalGhost( GhostAgent ): method __init__ (line 47) | def __init__( self, index, prob_attack=0.8, prob_scaredFlee=0.8 ): method getDistribution (line 52) | def getDistribution( self, state ): FILE: Project-3/grading.py class Grades (line 25) | class Grades: method __init__ (line 27) | def __init__(self, projectName, questionsAndMaxesList, edxOutput=False... method addPrereq (line 48) | def addPrereq(self, question, prereq): method grade (line 51) | def grade(self, gradingModule, exceptionMap = {}, bonusPic = False): method addExceptionMessage (line 139) | def addExceptionMessage(self, q, inst, traceback): method addErrorHints (line 149) | def addErrorHints(self, exceptionMap, errorInstance, questionNum): method produceOutput (line 171) | def produceOutput(self): method fail (line 227) | def fail(self, message, raw=False): method assignZeroCredit (line 233) | def assignZeroCredit(self): method addPoints (line 236) | def addPoints(self, amt): method deductPoints (line 239) | def deductPoints(self, amt): method assignFullCredit (line 242) | def assignFullCredit(self, message="", raw=False): method addMessage (line 247) | def addMessage(self, message, raw=False): method addMessageToEmail (line 256) | def addMessageToEmail(self, message): class Counter (line 267) | class Counter(dict): method __getitem__ (line 271) | def __getitem__(self, idx): method totalCount (line 277) | def totalCount(self): FILE: Project-3/graphicsCrawlerDisplay.py class Application (line 37) | class Application: method sigmoid (line 39) | def sigmoid(self, x): method incrementSpeed (line 42) | def incrementSpeed(self, inc): method incrementEpsilon (line 49) | def incrementEpsilon(self, inc): method incrementGamma (line 55) | def incrementGamma(self, inc): method incrementAlpha (line 61) | def incrementAlpha(self, inc): method __initGUI (line 67) | def __initGUI(self, win): method setupAlphaButtonAndLabel (line 99) | def setupAlphaButtonAndLabel(self, win): method setUpGammaButtonAndLabel (line 112) | def setUpGammaButtonAndLabel(self, win): method setupEpsilonButtonAndLabel (line 125) | def setupEpsilonButtonAndLabel(self, win): method setupSpeedButtonAndLabel (line 138) | def setupSpeedButtonAndLabel(self, win): method skip5kSteps (line 156) | def skip5kSteps(self): method __init__ (line 159) | def __init__(self, win): method exit (line 199) | def exit(self): method step (line 210) | def step(self): method animatePolicy (line 227) | def animatePolicy(self): method run (line 288) | def run(self): method start (line 307) | def start(self): function run (line 314) | def run(): FILE: Project-3/graphicsDisplay.py class InfoPane (line 82) | class InfoPane: method __init__ (line 83) | def __init__(self, layout, gridSize): method toScreen (line 92) | def toScreen(self, pos, y = None): method drawPane (line 105) | def drawPane(self): method initializeGhostDistances (line 108) | def initializeGhostDistances(self, distances): method updateScore (line 121) | def updateScore(self, score): method setTeam (line 124) | def setTeam(self, isBlue): method updateGhostDistances (line 129) | def updateGhostDistances(self, distances): method drawGhost (line 136) | def drawGhost(self): method drawPacman (line 139) | def drawPacman(self): method drawWarning (line 142) | def drawWarning(self): method clearIcon (line 145) | def clearIcon(self): method updateMessage (line 148) | def updateMessage(self, message): method clearMessage (line 151) | def clearMessage(self): class PacmanGraphics (line 155) | class PacmanGraphics: method __init__ (line 156) | def __init__(self, zoom=1.0, frameTime=0.0, capture=False): method checkNullDisplay (line 165) | def checkNullDisplay(self): method initialize (line 168) | def initialize(self, state, isBlue = False): method startGraphics (line 180) | def startGraphics(self, state): method drawDistributions (line 189) | def drawDistributions(self, state): method drawStaticObjects (line 204) | def drawStaticObjects(self, state): method drawAgentObjects (line 211) | def drawAgentObjects(self, state): method swapImages (line 222) | def swapImages(self, agentIndex, newState): method update (line 236) | def update(self, newState): method make_window (line 256) | def make_window(self, width, height): method drawPacman (line 267) | def drawPacman(self, pacman, index): method getEndpoints (line 286) | def getEndpoints(self, direction, position=(0,0)): method movePacman (line 302) | def movePacman(self, position, direction, image): method animatePacman (line 309) | def animatePacman(self, pacman, prevPacman, image): method getGhostColor (line 329) | def getGhostColor(self, ghost, ghostIndex): method drawGhost (line 335) | def drawGhost(self, ghost, agentIndex): method moveEyes (line 371) | def moveEyes(self, pos, dir, eyes): method moveGhost (line 388) | def moveGhost(self, ghost, ghostIndex, prevGhost, ghostImageParts): method getPosition (line 405) | def getPosition(self, agentState): method getDirection (line 409) | def getDirection(self, agentState): method finish (line 413) | def finish(self): method to_screen (line 416) | def to_screen(self, point): method to_screen2 (line 424) | def to_screen2(self, point): method drawWalls (line 431) | def drawWalls(self, wallMatrix): method isWall (line 517) | def isWall(self, x, y, walls): method drawFood (line 524) | def drawFood(self, foodMatrix ): method drawCapsules (line 544) | def drawCapsules(self, capsules ): method removeFood (line 556) | def removeFood(self, cell, foodImages ): method removeCapsule (line 560) | def removeCapsule(self, cell, capsuleImages ): method drawExpandedCells (line 564) | def drawExpandedCells(self, cells): method clearExpandedCells (line 583) | def clearExpandedCells(self): method updateDistributions (line 589) | def updateDistributions(self, distributions): class FirstPersonPacmanGraphics (line 611) | class FirstPersonPacmanGraphics(PacmanGraphics): method __init__ (line 612) | def __init__(self, zoom = 1.0, showGhosts = True, capture = False, fra... method initialize (line 617) | def initialize(self, state, isBlue = False): method lookAhead (line 634) | def lookAhead(self, config, state): method getGhostColor (line 648) | def getGhostColor(self, ghost, ghostIndex): method getPosition (line 651) | def getPosition(self, ghostState): function add (line 657) | def add(x, y): function saveFrame (line 672) | def saveFrame(): FILE: Project-3/graphicsGridworldDisplay.py class GraphicsGridworldDisplay (line 18) | class GraphicsGridworldDisplay: method __init__ (line 20) | def __init__(self, gridworld, size=120, speed=1.0): method start (line 25) | def start(self): method pause (line 28) | def pause(self): method displayValues (line 31) | def displayValues(self, agent, currentState = None, message = 'Agent V... method displayNullValues (line 41) | def displayNullValues(self, currentState = None, message = ''): method displayQValues (line 52) | def displayQValues(self, agent, currentState = None, message = 'Agent ... function setup (line 73) | def setup(gridworld, title = "Gridworld Display", size = 120): function drawNullValues (line 87) | def drawNullValues(gridworld, currentState = None, message = ''): function drawValues (line 104) | def drawValues(gridworld, values, policy, currentState = None, message =... function drawQValues (line 131) | def drawQValues(gridworld, qValues, currentState = None, message = 'Stat... function blank (line 170) | def blank(): function drawNullSquare (line 173) | def drawNullSquare(grid,x, y, isObstacle, isTerminal, isCurrent): function drawSquare (line 213) | def drawSquare(x, y, val, min, max, valStr, action, isObstacle, isTermin... function drawSquareQ (line 258) | def drawSquareQ(x, y, qVals, minVal, maxVal, valStrs, bestActions, isCur... function getColor (line 322) | def getColor(val, minVal, max): function square (line 331) | def square(pos, size, color, filled, width): function to_screen (line 337) | def to_screen(point): function to_grid (line 343) | def to_grid(point): FILE: Project-3/graphicsUtils.py function formatColor (line 35) | def formatColor(r, g, b): function colorToVector (line 38) | def colorToVector(color): function sleep (line 47) | def sleep(secs): function begin_graphics (line 56) | def begin_graphics(width=640, height=480, color=formatColor(0, 0, 0), ti... function _leftclick (line 101) | def _leftclick(event): function _rightclick (line 105) | def _rightclick(event): function _ctrl_leftclick (line 109) | def _ctrl_leftclick(event): function wait_for_click (line 113) | def wait_for_click(): function draw_background (line 132) | def draw_background(): function _destroy_window (line 136) | def _destroy_window(event=None): function end_graphics (line 143) | def end_graphics(): function clear_screen (line 158) | def clear_screen(background=None): function polygon (line 164) | def polygon(coords, outlineColor, fillColor=None, filled=1, smoothed=1, ... function square (line 176) | def square(pos, r, color, filled=1, behind=0): function circle (line 181) | def circle(pos, r, outlineColor, fillColor, endpoints=None, style='piesl... function image (line 194) | def image(pos, file="../../blueghost.gif"): function refresh (line 200) | def refresh(): function moveCircle (line 203) | def moveCircle(id, pos, r, endpoints=None): function edit (line 220) | def edit(id, *args): function text (line 223) | def text(pos, color, contents, font='Helvetica', size=12, style='normal'... function changeText (line 229) | def changeText(id, newText, font=None, size=12, style='normal'): function changeColor (line 234) | def changeColor(id, newColor): function line (line 237) | def line(here, there, color=formatColor(0, 0, 0), width=2): function _keypress (line 254) | def _keypress(event): function _keyrelease (line 262) | def _keyrelease(event): function remap_arrows (line 271) | def remap_arrows(event): function _clear_keys (line 284) | def _clear_keys(event=None): function keys_pressed (line 290) | def keys_pressed(d_o_e=Tkinter.tkinter.dooneevent, function keys_waiting (line 297) | def keys_waiting(): function wait_for_keys (line 305) | def wait_for_keys(): function remove_from_screen (line 312) | def remove_from_screen(x, function _adjust_coords (line 318) | def _adjust_coords(coord_list, x, y): function move_to (line 324) | def move_to(object, x, y=None, function move_by (line 346) | def move_by(object, x, y=None, function writePostscript (line 369) | def writePostscript(filename): FILE: Project-3/gridworld.py class Gridworld (line 22) | class Gridworld(mdp.MarkovDecisionProcess): method __init__ (line 26) | def __init__(self, grid): method setLivingReward (line 35) | def setLivingReward(self, reward): method setNoise (line 45) | def setNoise(self, noise): method getPossibleActions (line 52) | def getPossibleActions(self, state): method getStates (line 67) | def getStates(self): method getReward (line 80) | def getReward(self, state, action, nextState): method getStartState (line 96) | def getStartState(self): method isTerminal (line 103) | def isTerminal(self, state): method getTransitionStatesAndProbs (line 114) | def getTransitionStatesAndProbs(self, state, action): method __aggregate (line 165) | def __aggregate(self, statesAndProbs): method __isAllowed (line 174) | def __isAllowed(self, y, x): class GridworldEnvironment (line 179) | class GridworldEnvironment(environment.Environment): method __init__ (line 181) | def __init__(self, gridWorld): method getCurrentState (line 185) | def getCurrentState(self): method getPossibleActions (line 188) | def getPossibleActions(self, state): method doAction (line 191) | def doAction(self, action): method getRandomNextState (line 197) | def getRandomNextState(self, state, action, randObj=None): method reset (line 214) | def reset(self): class Grid (line 217) | class Grid: method __init__ (line 225) | def __init__(self, width, height, initialValue=' '): method __getitem__ (line 231) | def __getitem__(self, i): method __setitem__ (line 234) | def __setitem__(self, key, item): method __eq__ (line 237) | def __eq__(self, other): method __hash__ (line 241) | def __hash__(self): method copy (line 244) | def copy(self): method deepCopy (line 249) | def deepCopy(self): method shallowCopy (line 252) | def shallowCopy(self): method _getLegacyText (line 257) | def _getLegacyText(self): method __str__ (line 262) | def __str__(self): function makeGrid (line 265) | def makeGrid(gridString): function getCliffGrid (line 274) | def getCliffGrid(): function getCliffGrid2 (line 280) | def getCliffGrid2(): function getDiscountGrid (line 286) | def getDiscountGrid(): function getBridgeGrid (line 294) | def getBridgeGrid(): function getBookGrid (line 300) | def getBookGrid(): function getMazeGrid (line 306) | def getMazeGrid(): function getUserAction (line 316) | def getUserAction(state, actionFunction): function printString (line 338) | def printString(x): print x function runEpisode (line 340) | def runEpisode(agent, environment, discount, decision, display, message,... function parseOptions (line 380) | def parseOptions(): class RandomAgent (line 500) | class RandomAgent: method getAction (line 501) | def getAction(self, state): method getValue (line 503) | def getValue(self, state): method getQValue (line 505) | def getQValue(self, state, action): method getPolicy (line 507) | def getPolicy(self, state): method update (line 510) | def update(self, state, action, nextState, reward): FILE: Project-3/keyboardAgents.py class KeyboardAgent (line 19) | class KeyboardAgent(Agent): method __init__ (line 30) | def __init__( self, index = 0 ): method getAction (line 36) | def getAction( self, state): method getMove (line 59) | def getMove(self, legal): class KeyboardAgent2 (line 67) | class KeyboardAgent2(KeyboardAgent): method getMove (line 78) | def getMove(self, legal): FILE: Project-3/layout.py class Layout (line 22) | class Layout: method __init__ (line 27) | def __init__(self, layoutText): method getNumGhosts (line 40) | def getNumGhosts(self): method initializeVisibilityMatrix (line 43) | def initializeVisibilityMatrix(self): method isWall (line 64) | def isWall(self, pos): method getRandomLegalPosition (line 68) | def getRandomLegalPosition(self): method getRandomCorner (line 76) | def getRandomCorner(self): method getFurthestCorner (line 80) | def getFurthestCorner(self, pacPos): method isVisibleFrom (line 85) | def isVisibleFrom(self, ghostPos, pacPos, pacDirection): method __str__ (line 89) | def __str__(self): method deepCopy (line 92) | def deepCopy(self): method processLayoutText (line 95) | def processLayoutText(self, layoutText): method processLayoutChar (line 116) | def processLayoutChar(self, x, y, layoutChar): function getLayout (line 131) | def getLayout(name, back = 2): function tryToLoad (line 145) | def tryToLoad(fullname): FILE: Project-3/learningAgents.py class ValueEstimationAgent (line 19) | class ValueEstimationAgent(Agent): method __init__ (line 36) | def __init__(self, alpha=1.0, epsilon=0.05, gamma=0.8, numTraining = 10): method getQValue (line 52) | def getQValue(self, state, action): method getValue (line 58) | def getValue(self, state): method getPolicy (line 67) | def getPolicy(self, state): method getAction (line 80) | def getAction(self, state): class ReinforcementAgent (line 87) | class ReinforcementAgent(ValueEstimationAgent): method update (line 105) | def update(self, state, action, nextState, reward): method getLegalActions (line 116) | def getLegalActions(self,state): method observeTransition (line 124) | def observeTransition(self, state,action,nextState,deltaReward): method startEpisode (line 135) | def startEpisode(self): method stopEpisode (line 143) | def stopEpisode(self): method isInTraining (line 157) | def isInTraining(self): method isInTesting (line 160) | def isInTesting(self): method __init__ (line 163) | def __init__(self, actionFn = None, numTraining=100, epsilon=0.5, alph... method setEpsilon (line 186) | def setEpsilon(self, epsilon): method setLearningRate (line 189) | def setLearningRate(self, alpha): method setDiscount (line 192) | def setDiscount(self, discount): method doAction (line 195) | def doAction(self,state,action): method observationFunction (line 206) | def observationFunction(self, state): method registerInitialState (line 216) | def registerInitialState(self, state): method final (line 221) | def final(self, state): FILE: Project-3/mdp.py class MarkovDecisionProcess (line 17) | class MarkovDecisionProcess: method getStates (line 19) | def getStates(self): method getStartState (line 26) | def getStartState(self): method getPossibleActions (line 32) | def getPossibleActions(self, state): method getTransitionStatesAndProbs (line 38) | def getTransitionStatesAndProbs(self, state, action): method getReward (line 51) | def getReward(self, state, action, nextState): method isTerminal (line 59) | def isTerminal(self, state): FILE: Project-3/pacman.py class GameState (line 55) | class GameState: method getAndResetExplored (line 76) | def getAndResetExplored(): method getLegalActions (line 82) | def getLegalActions( self, agentIndex=0 ): method generateSuccessor (line 94) | def generateSuccessor( self, agentIndex, action): method getLegalPacmanActions (line 127) | def getLegalPacmanActions( self ): method generatePacmanSuccessor (line 130) | def generatePacmanSuccessor( self, action ): method getPacmanState (line 136) | def getPacmanState( self ): method getPacmanPosition (line 145) | def getPacmanPosition( self ): method getGhostStates (line 148) | def getGhostStates( self ): method getGhostState (line 151) | def getGhostState( self, agentIndex ): method getGhostPosition (line 156) | def getGhostPosition( self, agentIndex ): method getGhostPositions (line 161) | def getGhostPositions(self): method getNumAgents (line 164) | def getNumAgents( self ): method getScore (line 167) | def getScore( self ): method getCapsules (line 170) | def getCapsules(self): method getNumFood (line 176) | def getNumFood( self ): method getFood (line 179) | def getFood(self): method getWalls (line 191) | def getWalls(self): method hasFood (line 203) | def hasFood(self, x, y): method hasWall (line 206) | def hasWall(self, x, y): method isLose (line 209) | def isLose( self ): method isWin (line 212) | def isWin( self ): method __init__ (line 220) | def __init__( self, prevState = None ): method deepCopy (line 229) | def deepCopy( self ): method __eq__ (line 234) | def __eq__( self, other ): method __hash__ (line 240) | def __hash__( self ): method __str__ (line 246) | def __str__( self ): method initialize (line 250) | def initialize( self, layout, numGhostAgents=1000 ): class ClassicGameRules (line 266) | class ClassicGameRules: method __init__ (line 271) | def __init__(self, timeout=30): method newGame (line 274) | def newGame( self, layout, pacmanAgent, ghostAgents, display, quiet = ... method process (line 284) | def process(self, state, game): method win (line 291) | def win( self, state, game ): method lose (line 295) | def lose( self, state, game ): method getProgress (line 299) | def getProgress(self, game): method agentCrash (line 302) | def agentCrash(self, game, agentIndex): method getMaxTotalTime (line 308) | def getMaxTotalTime(self, agentIndex): method getMaxStartupTime (line 311) | def getMaxStartupTime(self, agentIndex): method getMoveWarningTime (line 314) | def getMoveWarningTime(self, agentIndex): method getMoveTimeout (line 317) | def getMoveTimeout(self, agentIndex): method getMaxTimeWarnings (line 320) | def getMaxTimeWarnings(self, agentIndex): class PacmanRules (line 323) | class PacmanRules: method getLegalActions (line 330) | def getLegalActions( state ): method applyAction (line 337) | def applyAction( state, action ): method consume (line 359) | def consume( position, state ): class GhostRules (line 381) | class GhostRules: method getLegalActions (line 386) | def getLegalActions( state, ghostIndex ): method applyAction (line 401) | def applyAction( state, action, ghostIndex): method decrementTimer (line 414) | def decrementTimer( ghostState): method checkDeath (line 421) | def checkDeath( state, agentIndex): method collide (line 436) | def collide( state, ghostState, agentIndex): method canKill (line 449) | def canKill( pacmanPosition, ghostPosition ): method placeGhost (line 453) | def placeGhost(state, ghostState): function default (line 461) | def default(str): function parseAgentArgs (line 464) | def parseAgentArgs(str): function readCommand (line 476) | def readCommand( argv ): function loadAgent (line 587) | def loadAgent(pacman, nographics): function replayGame (line 610) | def replayGame( layout, actions, display ): function runGames (line 628) | def runGames( layout, pacman, ghosts, display, numGames, record, numTrai... FILE: Project-3/pacmanAgents.py class LeftTurnAgent (line 21) | class LeftTurnAgent(game.Agent): method getAction (line 24) | def getAction(self, state): class GreedyAgent (line 35) | class GreedyAgent(Agent): method __init__ (line 36) | def __init__(self, evalFn="scoreEvaluation"): method getAction (line 40) | def getAction(self, state): function scoreEvaluation (line 51) | def scoreEvaluation(state): FILE: Project-3/qlearningAgents.py class QLearningAgent (line 21) | class QLearningAgent(ReinforcementAgent): method __init__ (line 41) | def __init__(self, **args): method getQValue (line 47) | def getQValue(self, state, action): method computeValueFromQValues (line 56) | def computeValueFromQValues(self, state): method computeActionFromQValues (line 69) | def computeActionFromQValues(self, state): method getAction (line 81) | def getAction(self, state): method update (line 102) | def update(self, state, action, nextState, reward): method getPolicy (line 116) | def getPolicy(self, state): method getValue (line 119) | def getValue(self, state): class PacmanQAgent (line 123) | class PacmanQAgent(QLearningAgent): method __init__ (line 126) | def __init__(self, epsilon=0.05,gamma=0.8,alpha=0.2, numTraining=0, **... method getAction (line 144) | def getAction(self, state): class ApproximateQAgent (line 155) | class ApproximateQAgent(PacmanQAgent): method __init__ (line 163) | def __init__(self, extractor='IdentityExtractor', **args): method getWeights (line 168) | def getWeights(self): method getQValue (line 171) | def getQValue(self, state, action): method update (line 182) | def update(self, state, action, nextState, reward): method final (line 192) | def final(self, state): FILE: Project-3/reinforcementTestClasses.py class ValueIterationTest (line 31) | class ValueIterationTest(testClasses.TestCase): method __init__ (line 33) | def __init__(self, question, testDict): method writeFailureFile (line 46) | def writeFailureFile(self, string): method removeFailureFileIfExists (line 50) | def removeFailureFileIfExists(self): method execute (line 54) | def execute(self, grades, moduleDict, solutionDict): method executeNIterations (line 70) | def executeNIterations(self, grades, moduleDict, solutionDict, n, chec... method writeSolution (line 109) | def writeSolution(self, moduleDict, filePath): method runAgent (line 122) | def runAgent(self, moduleDict, numIterations): method prettyPrint (line 147) | def prettyPrint(self, elements, formatString): method prettyValues (line 166) | def prettyValues(self, values): method prettyPolicy (line 169) | def prettyPolicy(self, policy): method prettyValueSolutionString (line 172) | def prettyValueSolutionString(self, name, pretty): method comparePrettyValues (line 175) | def comparePrettyValues(self, aPretty, bPretty, tolerance=0.01): method parsePrettyValues (line 193) | def parsePrettyValues(self, pretty): class ApproximateQLearningTest (line 198) | class ApproximateQLearningTest(testClasses.TestCase): method __init__ (line 200) | def __init__(self, question, testDict): method writeFailureFile (line 221) | def writeFailureFile(self, string): method removeFailureFileIfExists (line 225) | def removeFailureFileIfExists(self): method execute (line 229) | def execute(self, grades, moduleDict, solutionDict): method executeNExperiences (line 244) | def executeNExperiences(self, grades, moduleDict, solutionDict, n): method writeSolution (line 270) | def writeSolution(self, moduleDict, filePath): method runAgent (line 279) | def runAgent(self, moduleDict, numExperiences): method prettyPrint (line 310) | def prettyPrint(self, elements, formatString): method prettyValues (line 329) | def prettyValues(self, values): method prettyPolicy (line 332) | def prettyPolicy(self, policy): method prettyValueSolutionString (line 335) | def prettyValueSolutionString(self, name, pretty): method comparePrettyValues (line 338) | def comparePrettyValues(self, aPretty, bPretty, tolerance=0.01): method parsePrettyValues (line 356) | def parsePrettyValues(self, pretty): class QLearningTest (line 361) | class QLearningTest(testClasses.TestCase): method __init__ (line 363) | def __init__(self, question, testDict): method writeFailureFile (line 381) | def writeFailureFile(self, string): method removeFailureFileIfExists (line 385) | def removeFailureFileIfExists(self): method execute (line 389) | def execute(self, grades, moduleDict, solutionDict): method executeNExperiences (line 405) | def executeNExperiences(self, grades, moduleDict, solutionDict, n, che... method writeSolution (line 442) | def writeSolution(self, moduleDict, filePath): method runAgent (line 454) | def runAgent(self, moduleDict, numExperiences): method prettyPrint (line 490) | def prettyPrint(self, elements, formatString): method prettyValues (line 509) | def prettyValues(self, values): method prettyPolicy (line 512) | def prettyPolicy(self, policy): method prettyValueSolutionString (line 515) | def prettyValueSolutionString(self, name, pretty): method comparePrettyValues (line 518) | def comparePrettyValues(self, aPretty, bPretty, tolerance=0.01): method parsePrettyValues (line 536) | def parsePrettyValues(self, pretty): class EpsilonGreedyTest (line 541) | class EpsilonGreedyTest(testClasses.TestCase): method __init__ (line 543) | def __init__(self, question, testDict): method execute (line 558) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 564) | def writeSolution(self, moduleDict, filePath): method runAgent (line 570) | def runAgent(self, moduleDict): method testEpsilonGreedy (line 584) | def testEpsilonGreedy(self, moduleDict, tolerance=0.025): class Question6Test (line 610) | class Question6Test(testClasses.TestCase): method __init__ (line 612) | def __init__(self, question, testDict): method execute (line 615) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 626) | def writeSolution(self, moduleDict, filePath): class EvalAgentTest (line 638) | class EvalAgentTest(testClasses.TestCase): method __init__ (line 640) | def __init__(self, question, testDict): method execute (line 655) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 715) | def writeSolution(self, moduleDict, filePath): function followPath (line 728) | def followPath(policy, start, numSteps=100): function parseGrid (line 747) | def parseGrid(string): function computePolicy (line 761) | def computePolicy(moduleDict, grid, discount): class GridPolicyTest (line 770) | class GridPolicyTest(testClasses.TestCase): method __init__ (line 772) | def __init__(self, question, testDict): method execute (line 806) | def execute(self, grades, moduleDict, solutionDict): method printGridworld (line 896) | def printGridworld(self): method printPolicy (line 902) | def printPolicy(self, policy, policyTypeIsGrid): method writeSolution (line 919) | def writeSolution(self, moduleDict, filePath): FILE: Project-3/testClasses.py class Question (line 24) | class Question(object): method raiseNotDefined (line 26) | def raiseNotDefined(self): method __init__ (line 30) | def __init__(self, questionDict, display): method getDisplay (line 35) | def getDisplay(self): method getMaxPoints (line 38) | def getMaxPoints(self): method addTestCase (line 43) | def addTestCase(self, testCase, thunk): method execute (line 46) | def execute(self, grades): class PassAllTestsQuestion (line 50) | class PassAllTestsQuestion(Question): method execute (line 52) | def execute(self, grades): class HackedPartialCreditQuestion (line 67) | class HackedPartialCreditQuestion(Question): method execute (line 69) | def execute(self, grades): class Q6PartialCreditQuestion (line 89) | class Q6PartialCreditQuestion(Question): method execute (line 93) | def execute(self, grades): class PartialCreditQuestion (line 102) | class PartialCreditQuestion(Question): method execute (line 106) | def execute(self, grades): class NumberPassedQuestion (line 117) | class NumberPassedQuestion(Question): method execute (line 120) | def execute(self, grades): class TestCase (line 128) | class TestCase(object): method raiseNotDefined (line 130) | def raiseNotDefined(self): method getPath (line 134) | def getPath(self): method __init__ (line 137) | def __init__(self, question, testDict): method __str__ (line 143) | def __str__(self): method execute (line 146) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 149) | def writeSolution(self, moduleDict, filePath): method testPass (line 159) | def testPass(self, grades): method testFail (line 165) | def testFail(self, grades): method testPartial (line 173) | def testPartial(self, grades, points, maxPoints): method addMessage (line 187) | def addMessage(self, message): FILE: Project-3/testParser.py class TestParser (line 18) | class TestParser(object): method __init__ (line 20) | def __init__(self, path): method removeComments (line 24) | def removeComments(self, rawlines): method parse (line 35) | def parse(self): function emitTestDict (line 76) | def emitTestDict(testDict, handle): FILE: Project-3/textDisplay.py class NullGraphics (line 26) | class NullGraphics: method initialize (line 27) | def initialize(self, state, isBlue = False): method update (line 30) | def update(self, state): method checkNullDisplay (line 33) | def checkNullDisplay(self): method pause (line 36) | def pause(self): method draw (line 39) | def draw(self, state): method updateDistributions (line 42) | def updateDistributions(self, dist): method finish (line 45) | def finish(self): class PacmanGraphics (line 48) | class PacmanGraphics: method __init__ (line 49) | def __init__(self, speed=None): method initialize (line 54) | def initialize(self, state, isBlue = False): method update (line 60) | def update(self, state): method pause (line 74) | def pause(self): method draw (line 77) | def draw(self, state): method finish (line 80) | def finish(self): FILE: Project-3/textGridworldDisplay.py class TextGridworldDisplay (line 17) | class TextGridworldDisplay: method __init__ (line 19) | def __init__(self, gridworld): method start (line 22) | def start(self): method pause (line 25) | def pause(self): method displayValues (line 28) | def displayValues(self, agent, currentState = None, message = None): method displayNullValues (line 39) | def displayNullValues(self, agent, currentState = None, message = None): method displayQValues (line 43) | def displayQValues(self, agent, currentState = None, message = None): function prettyPrintValues (line 53) | def prettyPrintValues(gridWorld, values, policy=None, currentState = None): function prettyPrintNullValues (line 109) | def prettyPrintNullValues(gridWorld, currentState = None): function prettyPrintQValues (line 176) | def prettyPrintQValues(gridWorld, qValues, currentState=None): function border (line 247) | def border(text): function indent (line 259) | def indent(rows, hasHeader=False, headerChar='-', delim=' | ', justify='... function wrap_always (line 301) | def wrap_always(text, width): FILE: Project-3/util.py class FixedRandom (line 21) | class FixedRandom: method __init__ (line 22) | def __init__(self): class Stack (line 120) | class Stack: method __init__ (line 122) | def __init__(self): method push (line 125) | def push(self,item): method pop (line 129) | def pop(self): method isEmpty (line 133) | def isEmpty(self): class Queue (line 137) | class Queue: method __init__ (line 139) | def __init__(self): method push (line 142) | def push(self,item): method pop (line 146) | def pop(self): method isEmpty (line 153) | def isEmpty(self): class PriorityQueue (line 157) | class PriorityQueue: method __init__ (line 168) | def __init__(self): method push (line 172) | def push(self, item, priority): method pop (line 180) | def pop(self): method isEmpty (line 185) | def isEmpty(self): class PriorityQueueWithFunction (line 188) | class PriorityQueueWithFunction(PriorityQueue): method __init__ (line 195) | def __init__(self, priorityFunction): method push (line 200) | def push(self, item): function manhattanDistance (line 205) | def manhattanDistance( xy1, xy2 ): class Counter (line 215) | class Counter(dict): method __getitem__ (line 255) | def __getitem__(self, idx): method incrementAll (line 259) | def incrementAll(self, keys, count): method argMax (line 273) | def argMax(self): method sortedKeys (line 283) | def sortedKeys(self): method totalCount (line 300) | def totalCount(self): method normalize (line 306) | def normalize(self): method divideAll (line 318) | def divideAll(self, divisor): method copy (line 326) | def copy(self): method __mul__ (line 332) | def __mul__(self, y ): method __radd__ (line 358) | def __radd__(self, y): method __add__ (line 376) | def __add__( self, y ): method __sub__ (line 402) | def __sub__( self, y ): function raiseNotDefined (line 428) | def raiseNotDefined(): function normalize (line 436) | def normalize(vectorOrCounter): function nSample (line 455) | def nSample(distribution, values, n): function sample (line 471) | def sample(distribution, values = None): function sampleFromCounter (line 485) | def sampleFromCounter(ctr): function getProbability (line 489) | def getProbability(value, distribution, values): function flipCoin (line 500) | def flipCoin( p ): function chooseFromDistribution (line 504) | def chooseFromDistribution( distribution ): function nearestPoint (line 514) | def nearestPoint( pos ): function sign (line 524) | def sign( x ): function arrayInvert (line 533) | def arrayInvert(array): function matrixAsList (line 543) | def matrixAsList( matrix, value = True ): function lookup (line 555) | def lookup(name, namespace): function pause (line 573) | def pause(): class TimeoutFunctionException (line 591) | class TimeoutFunctionException(Exception): class TimeoutFunction (line 596) | class TimeoutFunction: method __init__ (line 597) | def __init__(self, function, timeout): method handle_timeout (line 601) | def handle_timeout(self, signum, frame): method __call__ (line 604) | def __call__(self, *args, **keyArgs): class WritableNull (line 630) | class WritableNull: method write (line 631) | def write(self, string): function mutePrint (line 634) | def mutePrint(): function unmutePrint (line 645) | def unmutePrint(): FILE: Project-3/valueIterationAgents.py class ValueIterationAgent (line 19) | class ValueIterationAgent(ValueEstimationAgent): method __init__ (line 28) | def __init__(self, mdp, discount = 0.9, iterations = 100): method getValue (line 57) | def getValue(self, state): method computeQValueFromValues (line 64) | def computeQValueFromValues(self, state, action): method computeActionFromValues (line 74) | def computeActionFromValues(self, state): method getPolicy (line 93) | def getPolicy(self, state): method getAction (line 96) | def getAction(self, state): method getQValue (line 100) | def getQValue(self, state, action): FILE: Project-4/autograder.py function readCommand (line 31) | def readCommand(argv): function confirmGenerate (line 83) | def confirmGenerate(): function setModuleName (line 100) | def setModuleName(module, filename): function loadModuleString (line 118) | def loadModuleString(moduleSource): function loadModuleFile (line 131) | def loadModuleFile(moduleName, filePath): function readFile (line 136) | def readFile(path, root=""): function splitStrings (line 173) | def splitStrings(d): function printTest (line 184) | def printTest(testDict, solutionDict): function runTest (line 194) | def runTest(testName, moduleDict, printTestCase=False, display=None): function getDepends (line 219) | def getDepends(testParser, testRoot, question): function getTestSubdirs (line 230) | def getTestSubdirs(testParser, testRoot, questionToGrade): function evaluate (line 243) | def evaluate(generateSolutions, testRoot, moduleDict, exceptionMap=ERROR... function getDisplay (line 310) | def getDisplay(graphicsByDefault, options=None): FILE: Project-4/busters.py function getNoisyDistance (line 42) | def getNoisyDistance(pos1, pos2): function getObservationDistribution (line 48) | def getObservationDistribution(noisyDistance): class GameState (line 67) | class GameState: method getLegalActions (line 86) | def getLegalActions( self, agentIndex=0 ): method generateSuccessor (line 97) | def generateSuccessor( self, agentIndex, action): method getLegalPacmanActions (line 132) | def getLegalPacmanActions( self ): method generatePacmanSuccessor (line 135) | def generatePacmanSuccessor( self, action ): method getPacmanState (line 141) | def getPacmanState( self ): method getPacmanPosition (line 150) | def getPacmanPosition( self ): method getNumAgents (line 153) | def getNumAgents( self ): method getScore (line 156) | def getScore( self ): method getCapsules (line 159) | def getCapsules(self): method getNumFood (line 165) | def getNumFood( self ): method getFood (line 168) | def getFood(self): method getWalls (line 180) | def getWalls(self): method hasFood (line 192) | def hasFood(self, x, y): method hasWall (line 195) | def hasWall(self, x, y): method getLivingGhosts (line 202) | def getLivingGhosts(self): method setGhostNotLiving (line 210) | def setGhostNotLiving(self, index): method isLose (line 213) | def isLose( self ): method isWin (line 216) | def isWin( self ): method getNoisyGhostDistances (line 219) | def getNoisyGhostDistances(self): method __init__ (line 230) | def __init__( self, prevState = None ): method deepCopy (line 245) | def deepCopy( self ): method __eq__ (line 251) | def __eq__( self, other ): method __hash__ (line 257) | def __hash__( self ): method __str__ (line 263) | def __str__( self ): method initialize (line 267) | def initialize( self, layout, numGhostAgents=1000 ): method getGhostPosition (line 275) | def getGhostPosition( self, agentIndex ): method getGhostState (line 280) | def getGhostState( self, agentIndex ): class BustersGameRules (line 294) | class BustersGameRules: method newGame (line 300) | def newGame( self, layout, pacmanAgent, ghostAgents, display, maxMoves... method process (line 309) | def process(self, state, game): method win (line 316) | def win( self, state, game ): method lose (line 319) | def lose( self, state, game ): class PacmanRules (line 322) | class PacmanRules: method getLegalActions (line 327) | def getLegalActions( state ): method applyAction (line 334) | def applyAction( state, action ): class GhostRules (line 350) | class GhostRules: method getLegalActions (line 354) | def getLegalActions( state, ghostIndex ): method applyAction (line 359) | def applyAction( state, action, ghostIndex): method decrementTimer (line 369) | def decrementTimer( ghostState): method checkDeath (line 376) | def checkDeath( state, agentIndex): method collide (line 391) | def collide( state, ghostState, agentIndex): method canKill (line 399) | def canKill( pacmanPosition, ghostPosition ): method placeGhost (line 403) | def placeGhost(ghostState, agentIndex): class RandomGhost (line 409) | class RandomGhost: method __init__ (line 410) | def __init__( self, index ): method getAction (line 413) | def getAction( self, state ): method getDistribution (line 416) | def getDistribution( self, state ): function default (line 425) | def default(str): function parseAgentArgs (line 428) | def parseAgentArgs(str): function readCommand (line 440) | def readCommand( argv ): function loadAgent (line 510) | def loadAgent(pacman, nographics): function runGames (line 533) | def runGames( layout, pacman, ghosts, display, numGames, maxMoves=-1): FILE: Project-4/bustersAgents.py class NullGraphics (line 22) | class NullGraphics: method initialize (line 24) | def initialize(self, state, isBlue = False): method update (line 26) | def update(self, state): method pause (line 28) | def pause(self): method draw (line 30) | def draw(self, state): method updateDistributions (line 32) | def updateDistributions(self, dist): method finish (line 34) | def finish(self): class KeyboardInference (line 37) | class KeyboardInference(inference.InferenceModule): method initializeUniformly (line 41) | def initializeUniformly(self, gameState): method observe (line 47) | def observe(self, observation, gameState): method elapseTime (line 59) | def elapseTime(self, gameState): method getBeliefDistribution (line 62) | def getBeliefDistribution(self): class BustersAgent (line 66) | class BustersAgent: method __init__ (line 69) | def __init__( self, index = 0, inference = "ExactInference", ghostAgen... method registerInitialState (line 75) | def registerInitialState(self, gameState): method observationFunction (line 84) | def observationFunction(self, gameState): method getAction (line 90) | def getAction(self, gameState): method chooseAction (line 102) | def chooseAction(self, gameState): class BustersKeyboardAgent (line 106) | class BustersKeyboardAgent(BustersAgent, KeyboardAgent): method __init__ (line 109) | def __init__(self, index = 0, inference = "KeyboardInference", ghostAg... method getAction (line 113) | def getAction(self, gameState): method chooseAction (line 116) | def chooseAction(self, gameState): class GreedyBustersAgent (line 123) | class GreedyBustersAgent(BustersAgent): method registerInitialState (line 126) | def registerInitialState(self, gameState): method chooseAction (line 131) | def chooseAction(self, gameState): FILE: Project-4/bustersGhostAgents.py class StationaryGhost (line 21) | class StationaryGhost( ghostAgents.GhostAgent ): method getDistribution (line 22) | def getDistribution( self, state ): class DispersingGhost (line 27) | class DispersingGhost( ghostAgents.GhostAgent ): method __init__ (line 29) | def __init__( self, index, spreadProb=0.5): method getDistribution (line 33) | def getDistribution( self, state ): FILE: Project-4/distanceCalculator.py class Distancer (line 35) | class Distancer: method __init__ (line 36) | def __init__(self, layout, background=True, default=10000): method getDistance (line 58) | def getDistance(self, pos1, pos2): method getDistanceOnGrid (line 77) | def getDistanceOnGrid(self, pos1, pos2): method isReadyForMazeDistance (line 84) | def isReadyForMazeDistance(self): function manhattanDistance (line 87) | def manhattanDistance(x, y ): function isInt (line 90) | def isInt(pos): function getGrids2D (line 94) | def getGrids2D(pos): function getGrids1D (line 101) | def getGrids1D(x): function waitOnDistanceCalculator (line 115) | def waitOnDistanceCalculator(t): class DistanceCalculator (line 120) | class DistanceCalculator(threading.Thread): method setAttr (line 121) | def setAttr(self, layout, distancer, default = 10000): method run (line 126) | def run(self): function computeDistances (line 145) | def computeDistances(layout): function getDistanceOnGrid (line 186) | def getDistanceOnGrid(distances, pos1, pos2): FILE: Project-4/game.py class Agent (line 32) | class Agent: method __init__ (line 39) | def __init__(self, index=0): method getAction (line 42) | def getAction(self, state): class Directions (line 49) | class Directions: class Configuration (line 70) | class Configuration: method __init__ (line 79) | def __init__(self, pos, direction): method getPosition (line 83) | def getPosition(self): method getDirection (line 86) | def getDirection(self): method isInteger (line 89) | def isInteger(self): method __eq__ (line 93) | def __eq__(self, other): method __hash__ (line 97) | def __hash__(self): method __str__ (line 102) | def __str__(self): method generateSuccessor (line 105) | def generateSuccessor(self, vector): class AgentState (line 120) | class AgentState: method __init__ (line 125) | def __init__( self, startConfiguration, isPacman ): method __str__ (line 133) | def __str__( self ): method __eq__ (line 139) | def __eq__( self, other ): method __hash__ (line 144) | def __hash__(self): method copy (line 147) | def copy( self ): method getPosition (line 155) | def getPosition(self): method getDirection (line 159) | def getDirection(self): class Grid (line 162) | class Grid: method __init__ (line 170) | def __init__(self, width, height, initialValue=False, bitRepresentatio... method __getitem__ (line 180) | def __getitem__(self, i): method __setitem__ (line 183) | def __setitem__(self, key, item): method __str__ (line 186) | def __str__(self): method __eq__ (line 191) | def __eq__(self, other): method __hash__ (line 195) | def __hash__(self): method copy (line 206) | def copy(self): method deepCopy (line 211) | def deepCopy(self): method shallowCopy (line 214) | def shallowCopy(self): method count (line 219) | def count(self, item =True ): method asList (line 222) | def asList(self, key = True): method packBits (line 229) | def packBits(self): method _cellIndexToPosition (line 248) | def _cellIndexToPosition(self, index): method _unpackBits (line 253) | def _unpackBits(self, bits): method _unpackInt (line 265) | def _unpackInt(self, packed, size): function reconstituteGrid (line 277) | def reconstituteGrid(bitRep): class Actions (line 287) | class Actions: method reverseDirection (line 302) | def reverseDirection(action): method vectorToDirection (line 314) | def vectorToDirection(vector): method directionToVector (line 327) | def directionToVector(direction, speed = 1.0): method getPossibleActions (line 332) | def getPossibleActions(config, walls): method getLegalNeighbors (line 351) | def getLegalNeighbors(position, walls): method getSuccessor (line 365) | def getSuccessor(position, action): class GameStateData (line 371) | class GameStateData: method __init__ (line 375) | def __init__( self, prevState = None ): method deepCopy (line 395) | def deepCopy( self ): method copyAgentStates (line 405) | def copyAgentStates( self, agentStates ): method __eq__ (line 411) | def __eq__( self, other ): method __hash__ (line 423) | def __hash__( self ): method __str__ (line 435) | def __str__( self ): method _foodWallStr (line 460) | def _foodWallStr( self, hasFood, hasWall ): method _pacStr (line 468) | def _pacStr( self, dir ): method _ghostStr (line 477) | def _ghostStr( self, dir ): method initialize (line 487) | def initialize( self, layout, numGhostAgents ): class Game (line 513) | class Game: method __init__ (line 518) | def __init__( self, agents, display, rules, startingIndex=0, muteAgent... method getProgress (line 534) | def getProgress(self): method _agentCrash (line 540) | def _agentCrash( self, agentIndex, quiet=False): method mute (line 550) | def mute(self, agentIndex): method unmute (line 559) | def unmute(self): method run (line 567) | def run( self ): FILE: Project-4/ghostAgents.py class GhostAgent (line 22) | class GhostAgent( Agent ): method __init__ (line 23) | def __init__( self, index ): method getAction (line 26) | def getAction( self, state ): method getDistribution (line 33) | def getDistribution(self, state): class RandomGhost (line 37) | class RandomGhost( GhostAgent ): method getDistribution (line 39) | def getDistribution( self, state ): class DirectionalGhost (line 45) | class DirectionalGhost( GhostAgent ): method __init__ (line 47) | def __init__( self, index, prob_attack=0.8, prob_scaredFlee=0.8 ): method getDistribution (line 52) | def getDistribution( self, state ): FILE: Project-4/grading.py class Grades (line 25) | class Grades: method __init__ (line 27) | def __init__(self, projectName, questionsAndMaxesList, edxOutput=False... method addPrereq (line 48) | def addPrereq(self, question, prereq): method grade (line 51) | def grade(self, gradingModule, exceptionMap = {}, bonusPic = False): method addExceptionMessage (line 139) | def addExceptionMessage(self, q, inst, traceback): method addErrorHints (line 149) | def addErrorHints(self, exceptionMap, errorInstance, questionNum): method produceOutput (line 171) | def produceOutput(self): method fail (line 227) | def fail(self, message, raw=False): method assignZeroCredit (line 233) | def assignZeroCredit(self): method addPoints (line 236) | def addPoints(self, amt): method deductPoints (line 239) | def deductPoints(self, amt): method assignFullCredit (line 242) | def assignFullCredit(self, message="", raw=False): method addMessage (line 247) | def addMessage(self, message, raw=False): method addMessageToEmail (line 256) | def addMessageToEmail(self, message): class Counter (line 267) | class Counter(dict): method __getitem__ (line 271) | def __getitem__(self, idx): method totalCount (line 277) | def totalCount(self): FILE: Project-4/graphicsDisplay.py class InfoPane (line 82) | class InfoPane: method __init__ (line 83) | def __init__(self, layout, gridSize): method toScreen (line 92) | def toScreen(self, pos, y = None): method drawPane (line 105) | def drawPane(self): method initializeGhostDistances (line 108) | def initializeGhostDistances(self, distances): method updateScore (line 121) | def updateScore(self, score): method setTeam (line 124) | def setTeam(self, isBlue): method updateGhostDistances (line 129) | def updateGhostDistances(self, distances): method drawGhost (line 136) | def drawGhost(self): method drawPacman (line 139) | def drawPacman(self): method drawWarning (line 142) | def drawWarning(self): method clearIcon (line 145) | def clearIcon(self): method updateMessage (line 148) | def updateMessage(self, message): method clearMessage (line 151) | def clearMessage(self): class PacmanGraphics (line 155) | class PacmanGraphics: method __init__ (line 156) | def __init__(self, zoom=1.0, frameTime=0.0, capture=False): method checkNullDisplay (line 165) | def checkNullDisplay(self): method initialize (line 168) | def initialize(self, state, isBlue = False): method startGraphics (line 180) | def startGraphics(self, state): method drawDistributions (line 189) | def drawDistributions(self, state): method drawStaticObjects (line 204) | def drawStaticObjects(self, state): method drawAgentObjects (line 211) | def drawAgentObjects(self, state): method swapImages (line 222) | def swapImages(self, agentIndex, newState): method update (line 236) | def update(self, newState): method make_window (line 256) | def make_window(self, width, height): method drawPacman (line 267) | def drawPacman(self, pacman, index): method getEndpoints (line 286) | def getEndpoints(self, direction, position=(0,0)): method movePacman (line 302) | def movePacman(self, position, direction, image): method animatePacman (line 309) | def animatePacman(self, pacman, prevPacman, image): method getGhostColor (line 329) | def getGhostColor(self, ghost, ghostIndex): method drawGhost (line 335) | def drawGhost(self, ghost, agentIndex): method moveEyes (line 371) | def moveEyes(self, pos, dir, eyes): method moveGhost (line 388) | def moveGhost(self, ghost, ghostIndex, prevGhost, ghostImageParts): method getPosition (line 405) | def getPosition(self, agentState): method getDirection (line 409) | def getDirection(self, agentState): method finish (line 413) | def finish(self): method to_screen (line 416) | def to_screen(self, point): method to_screen2 (line 424) | def to_screen2(self, point): method drawWalls (line 431) | def drawWalls(self, wallMatrix): method isWall (line 517) | def isWall(self, x, y, walls): method drawFood (line 524) | def drawFood(self, foodMatrix ): method drawCapsules (line 544) | def drawCapsules(self, capsules ): method removeFood (line 556) | def removeFood(self, cell, foodImages ): method removeCapsule (line 560) | def removeCapsule(self, cell, capsuleImages ): method drawExpandedCells (line 564) | def drawExpandedCells(self, cells): method clearExpandedCells (line 583) | def clearExpandedCells(self): method updateDistributions (line 589) | def updateDistributions(self, distributions): class FirstPersonPacmanGraphics (line 611) | class FirstPersonPacmanGraphics(PacmanGraphics): method __init__ (line 612) | def __init__(self, zoom = 1.0, showGhosts = True, capture = False, fra... method initialize (line 617) | def initialize(self, state, isBlue = False): method lookAhead (line 634) | def lookAhead(self, config, state): method getGhostColor (line 648) | def getGhostColor(self, ghost, ghostIndex): method getPosition (line 651) | def getPosition(self, ghostState): function add (line 657) | def add(x, y): function saveFrame (line 672) | def saveFrame(): FILE: Project-4/graphicsUtils.py function formatColor (line 35) | def formatColor(r, g, b): function colorToVector (line 38) | def colorToVector(color): function sleep (line 47) | def sleep(secs): function begin_graphics (line 56) | def begin_graphics(width=640, height=480, color=formatColor(0, 0, 0), ti... function _leftclick (line 101) | def _leftclick(event): function _rightclick (line 105) | def _rightclick(event): function _ctrl_leftclick (line 109) | def _ctrl_leftclick(event): function wait_for_click (line 113) | def wait_for_click(): function draw_background (line 132) | def draw_background(): function _destroy_window (line 136) | def _destroy_window(event=None): function end_graphics (line 143) | def end_graphics(): function clear_screen (line 158) | def clear_screen(background=None): function polygon (line 164) | def polygon(coords, outlineColor, fillColor=None, filled=1, smoothed=1, ... function square (line 176) | def square(pos, r, color, filled=1, behind=0): function circle (line 181) | def circle(pos, r, outlineColor, fillColor, endpoints=None, style='piesl... function image (line 194) | def image(pos, file="../../blueghost.gif"): function refresh (line 200) | def refresh(): function moveCircle (line 203) | def moveCircle(id, pos, r, endpoints=None): function edit (line 220) | def edit(id, *args): function text (line 223) | def text(pos, color, contents, font='Helvetica', size=12, style='normal'... function changeText (line 229) | def changeText(id, newText, font=None, size=12, style='normal'): function changeColor (line 234) | def changeColor(id, newColor): function line (line 237) | def line(here, there, color=formatColor(0, 0, 0), width=2): function _keypress (line 254) | def _keypress(event): function _keyrelease (line 262) | def _keyrelease(event): function remap_arrows (line 271) | def remap_arrows(event): function _clear_keys (line 284) | def _clear_keys(event=None): function keys_pressed (line 290) | def keys_pressed(d_o_e=Tkinter.tkinter.dooneevent, function keys_waiting (line 297) | def keys_waiting(): function wait_for_keys (line 305) | def wait_for_keys(): function remove_from_screen (line 312) | def remove_from_screen(x, function _adjust_coords (line 318) | def _adjust_coords(coord_list, x, y): function move_to (line 324) | def move_to(object, x, y=None, function move_by (line 346) | def move_by(object, x, y=None, function writePostscript (line 369) | def writePostscript(filename): FILE: Project-4/inference.py class InferenceModule (line 21) | class InferenceModule: method __init__ (line 31) | def __init__(self, ghostAgent): method getJailPosition (line 37) | def getJailPosition(self): method getPositionDistribution (line 40) | def getPositionDistribution(self, gameState): method setGhostPosition (line 56) | def setGhostPosition(self, gameState, ghostPosition): method observeState (line 74) | def observeState(self, gameState): method initialize (line 82) | def initialize(self, gameState): method initializeUniformly (line 92) | def initializeUniformly(self, gameState): method observe (line 96) | def observe(self, observation, gameState): method elapseTime (line 100) | def elapseTime(self, gameState): method getBeliefDistribution (line 104) | def getBeliefDistribution(self): class ExactInference (line 111) | class ExactInference(InferenceModule): method initializeUniformly (line 117) | def initializeUniformly(self, gameState): method observe (line 124) | def observe(self, observation, gameState): method elapseTime (line 168) | def elapseTime(self, gameState): method getBeliefDistribution (line 230) | def getBeliefDistribution(self): class ParticleFilter (line 233) | class ParticleFilter(InferenceModule): method __init__ (line 242) | def __init__(self, ghostAgent, numParticles=300): method setNumParticles (line 246) | def setNumParticles(self, numParticles): method initializeUniformly (line 250) | def initializeUniformly(self, gameState): method observe (line 271) | def observe(self, observation, gameState): method elapseTime (line 319) | def elapseTime(self, gameState): method getBeliefDistribution (line 339) | def getBeliefDistribution(self): class MarginalInference (line 352) | class MarginalInference(InferenceModule): method initializeUniformly (line 358) | def initializeUniformly(self, gameState): method observeState (line 364) | def observeState(self, gameState): method elapseTime (line 369) | def elapseTime(self, gameState): method getBeliefDistribution (line 374) | def getBeliefDistribution(self): class JointParticleFilter (line 382) | class JointParticleFilter: method __init__ (line 388) | def __init__(self, numParticles=600): method setNumParticles (line 391) | def setNumParticles(self, numParticles): method initialize (line 394) | def initialize(self, gameState, legalPositions): method initializeParticles (line 401) | def initializeParticles(self): method addGhostAgent (line 433) | def addGhostAgent(self, agent): method getJailPosition (line 440) | def getJailPosition(self, i): method observeState (line 443) | def observeState(self, gameState): method getParticleWithGhostInJail (line 499) | def getParticleWithGhostInJail(self, particle, ghostIndex): method elapseTime (line 508) | def elapseTime(self, gameState): method getBeliefDistribution (line 561) | def getBeliefDistribution(self): function getPositionDistributionForGhost (line 571) | def getPositionDistributionForGhost(gameState, ghostIndex, agent): function setGhostPositions (line 585) | def setGhostPositions(gameState, ghostPositions): FILE: Project-4/keyboardAgents.py class KeyboardAgent (line 19) | class KeyboardAgent(Agent): method __init__ (line 30) | def __init__( self, index = 0 ): method getAction (line 36) | def getAction( self, state): method getMove (line 59) | def getMove(self, legal): class KeyboardAgent2 (line 67) | class KeyboardAgent2(KeyboardAgent): method getMove (line 78) | def getMove(self, legal): FILE: Project-4/layout.py class Layout (line 22) | class Layout: method __init__ (line 27) | def __init__(self, layoutText): method getNumGhosts (line 40) | def getNumGhosts(self): method initializeVisibilityMatrix (line 43) | def initializeVisibilityMatrix(self): method isWall (line 64) | def isWall(self, pos): method getRandomLegalPosition (line 68) | def getRandomLegalPosition(self): method getRandomCorner (line 76) | def getRandomCorner(self): method getFurthestCorner (line 80) | def getFurthestCorner(self, pacPos): method isVisibleFrom (line 85) | def isVisibleFrom(self, ghostPos, pacPos, pacDirection): method __str__ (line 89) | def __str__(self): method deepCopy (line 92) | def deepCopy(self): method processLayoutText (line 95) | def processLayoutText(self, layoutText): method processLayoutChar (line 116) | def processLayoutChar(self, x, y, layoutChar): function getLayout (line 131) | def getLayout(name, back = 2): function tryToLoad (line 145) | def tryToLoad(fullname): FILE: Project-4/pacman.py class GameState (line 55) | class GameState: method getAndResetExplored (line 76) | def getAndResetExplored(): method getLegalActions (line 82) | def getLegalActions( self, agentIndex=0 ): method generateSuccessor (line 94) | def generateSuccessor( self, agentIndex, action): method getLegalPacmanActions (line 127) | def getLegalPacmanActions( self ): method generatePacmanSuccessor (line 130) | def generatePacmanSuccessor( self, action ): method getPacmanState (line 136) | def getPacmanState( self ): method getPacmanPosition (line 145) | def getPacmanPosition( self ): method getGhostStates (line 148) | def getGhostStates( self ): method getGhostState (line 151) | def getGhostState( self, agentIndex ): method getGhostPosition (line 156) | def getGhostPosition( self, agentIndex ): method getGhostPositions (line 161) | def getGhostPositions(self): method getNumAgents (line 164) | def getNumAgents( self ): method getScore (line 167) | def getScore( self ): method getCapsules (line 170) | def getCapsules(self): method getNumFood (line 176) | def getNumFood( self ): method getFood (line 179) | def getFood(self): method getWalls (line 191) | def getWalls(self): method hasFood (line 203) | def hasFood(self, x, y): method hasWall (line 206) | def hasWall(self, x, y): method isLose (line 209) | def isLose( self ): method isWin (line 212) | def isWin( self ): method __init__ (line 220) | def __init__( self, prevState = None ): method deepCopy (line 229) | def deepCopy( self ): method __eq__ (line 234) | def __eq__( self, other ): method __hash__ (line 240) | def __hash__( self ): method __str__ (line 246) | def __str__( self ): method initialize (line 250) | def initialize( self, layout, numGhostAgents=1000 ): class ClassicGameRules (line 266) | class ClassicGameRules: method __init__ (line 271) | def __init__(self, timeout=30): method newGame (line 274) | def newGame( self, layout, pacmanAgent, ghostAgents, display, quiet = ... method process (line 284) | def process(self, state, game): method win (line 291) | def win( self, state, game ): method lose (line 295) | def lose( self, state, game ): method getProgress (line 299) | def getProgress(self, game): method agentCrash (line 302) | def agentCrash(self, game, agentIndex): method getMaxTotalTime (line 308) | def getMaxTotalTime(self, agentIndex): method getMaxStartupTime (line 311) | def getMaxStartupTime(self, agentIndex): method getMoveWarningTime (line 314) | def getMoveWarningTime(self, agentIndex): method getMoveTimeout (line 317) | def getMoveTimeout(self, agentIndex): method getMaxTimeWarnings (line 320) | def getMaxTimeWarnings(self, agentIndex): class PacmanRules (line 323) | class PacmanRules: method getLegalActions (line 330) | def getLegalActions( state ): method applyAction (line 337) | def applyAction( state, action ): method consume (line 359) | def consume( position, state ): class GhostRules (line 381) | class GhostRules: method getLegalActions (line 386) | def getLegalActions( state, ghostIndex ): method applyAction (line 401) | def applyAction( state, action, ghostIndex): method decrementTimer (line 414) | def decrementTimer( ghostState): method checkDeath (line 421) | def checkDeath( state, agentIndex): method collide (line 436) | def collide( state, ghostState, agentIndex): method canKill (line 449) | def canKill( pacmanPosition, ghostPosition ): method placeGhost (line 453) | def placeGhost(state, ghostState): function default (line 461) | def default(str): function parseAgentArgs (line 464) | def parseAgentArgs(str): function readCommand (line 476) | def readCommand( argv ): function loadAgent (line 587) | def loadAgent(pacman, nographics): function replayGame (line 610) | def replayGame( layout, actions, display ): function runGames (line 628) | def runGames( layout, pacman, ghosts, display, numGames, record, numTrai... FILE: Project-4/testClasses.py class Question (line 24) | class Question(object): method raiseNotDefined (line 26) | def raiseNotDefined(self): method __init__ (line 30) | def __init__(self, questionDict, display): method getDisplay (line 35) | def getDisplay(self): method getMaxPoints (line 38) | def getMaxPoints(self): method addTestCase (line 43) | def addTestCase(self, testCase, thunk): method execute (line 46) | def execute(self, grades): class PassAllTestsQuestion (line 50) | class PassAllTestsQuestion(Question): method execute (line 52) | def execute(self, grades): class HackedPartialCreditQuestion (line 67) | class HackedPartialCreditQuestion(Question): method execute (line 69) | def execute(self, grades): class Q6PartialCreditQuestion (line 89) | class Q6PartialCreditQuestion(Question): method execute (line 93) | def execute(self, grades): class PartialCreditQuestion (line 102) | class PartialCreditQuestion(Question): method execute (line 106) | def execute(self, grades): class NumberPassedQuestion (line 117) | class NumberPassedQuestion(Question): method execute (line 120) | def execute(self, grades): class TestCase (line 128) | class TestCase(object): method raiseNotDefined (line 130) | def raiseNotDefined(self): method getPath (line 134) | def getPath(self): method __init__ (line 137) | def __init__(self, question, testDict): method __str__ (line 143) | def __str__(self): method execute (line 146) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 149) | def writeSolution(self, moduleDict, filePath): method testPass (line 159) | def testPass(self, grades): method testFail (line 165) | def testFail(self, grades): method testPartial (line 173) | def testPartial(self, grades, points, maxPoints): method addMessage (line 187) | def addMessage(self, message): FILE: Project-4/testParser.py class TestParser (line 18) | class TestParser(object): method __init__ (line 20) | def __init__(self, path): method removeComments (line 24) | def removeComments(self, rawlines): method parse (line 35) | def parse(self): function emitTestDict (line 76) | def emitTestDict(testDict, handle): FILE: Project-4/textDisplay.py class NullGraphics (line 26) | class NullGraphics: method initialize (line 27) | def initialize(self, state, isBlue = False): method update (line 30) | def update(self, state): method checkNullDisplay (line 33) | def checkNullDisplay(self): method pause (line 36) | def pause(self): method draw (line 39) | def draw(self, state): method updateDistributions (line 42) | def updateDistributions(self, dist): method finish (line 45) | def finish(self): class PacmanGraphics (line 48) | class PacmanGraphics: method __init__ (line 49) | def __init__(self, speed=None): method initialize (line 54) | def initialize(self, state, isBlue = False): method update (line 60) | def update(self, state): method pause (line 74) | def pause(self): method draw (line 77) | def draw(self, state): method finish (line 80) | def finish(self): FILE: Project-4/trackingTestClasses.py class GameScoreTest (line 40) | class GameScoreTest(testClasses.TestCase): method __init__ (line 42) | def __init__(self, question, testDict): method execute (line 55) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 74) | def writeSolution(self, moduleDict, filePath): method createPublicVersion (line 79) | def createPublicVersion(self): class ZeroWeightTest (line 82) | class ZeroWeightTest(testClasses.TestCase): method __init__ (line 84) | def __init__(self, question, testDict): method execute (line 95) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 115) | def writeSolution(self, moduleDict, filePath): method createPublicVersion (line 120) | def createPublicVersion(self): class DoubleInferenceAgentTest (line 124) | class DoubleInferenceAgentTest(testClasses.TestCase): method __init__ (line 126) | def __init__(self, question, testDict): method execute (line 140) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 170) | def writeSolution(self, moduleDict, filePath): method createPublicVersion (line 199) | def createPublicVersion(self): function run (line 203) | def run(layout_str, pac, ghosts, disp, nGames = 1, name = 'games', maxMo... class InferenceAgent (line 222) | class InferenceAgent(bustersAgents.BustersAgent): method __init__ (line 225) | def __init__( self, inference, ghostAgents, seed, elapse=True, observe... method final (line 236) | def final(self, gameState): method registerInitialState (line 248) | def registerInitialState(self, gameState): method getAction (line 255) | def getAction(self, gameState): class ZeroWeightAgent (line 274) | class ZeroWeightAgent(bustersAgents.BustersAgent): method __init__ (line 277) | def __init__( self, inference, ghostAgents, grades, seed, disp, elapse... method final (line 287) | def final(self, gameState): method registerInitialState (line 290) | def registerInitialState(self, gameState): method getAction (line 296) | def getAction(self, gameState): method checkReset (line 314) | def checkReset(self, newBeliefs, oldBeliefs): method getReset (line 321) | def getReset(self): class DoubleInferenceAgent (line 325) | class DoubleInferenceAgent(bustersAgents.BustersAgent): method __init__ (line 328) | def __init__( self, inference, refSolution, ghostAgents, grades, seed,... method final (line 342) | def final(self, gameState): method registerInitialState (line 356) | def registerInitialState(self, gameState): method getAction (line 365) | def getAction(self, gameState): method distCompare (line 381) | def distCompare(self, dist, refDist): class SeededRandomGhostAgent (line 410) | class SeededRandomGhostAgent(Agent): method __init__ (line 411) | def __init__(self, index): method getAction (line 414) | def getAction(self, state): method getDistribution (line 424) | def getDistribution( self, state ): method sample (line 430) | def sample(self, distribution, values = None): class GoSouthAgent (line 444) | class GoSouthAgent(Agent): method __init__ (line 445) | def __init__(self, index): method getAction (line 448) | def getAction(self, state): method getDistribution (line 461) | def getDistribution( self, state ): method sample (line 470) | def sample(self, distribution, values = None): class DispersingSeededGhost (line 484) | class DispersingSeededGhost( Agent): method __init__ (line 486) | def __init__( self, index, spreadProb=0.5): method getAction (line 490) | def getAction(self, state): method getDistribution (line 498) | def getDistribution( self, state ): method sample (line 527) | def sample(self, distribution, values = None): FILE: Project-4/util.py class FixedRandom (line 21) | class FixedRandom: method __init__ (line 22) | def __init__(self): class Stack (line 120) | class Stack: method __init__ (line 122) | def __init__(self): method push (line 125) | def push(self,item): method pop (line 129) | def pop(self): method isEmpty (line 133) | def isEmpty(self): class Queue (line 137) | class Queue: method __init__ (line 139) | def __init__(self): method push (line 142) | def push(self,item): method pop (line 146) | def pop(self): method isEmpty (line 153) | def isEmpty(self): class PriorityQueue (line 157) | class PriorityQueue: method __init__ (line 168) | def __init__(self): method push (line 172) | def push(self, item, priority): method pop (line 180) | def pop(self): method isEmpty (line 185) | def isEmpty(self): class PriorityQueueWithFunction (line 188) | class PriorityQueueWithFunction(PriorityQueue): method __init__ (line 195) | def __init__(self, priorityFunction): method push (line 200) | def push(self, item): function manhattanDistance (line 205) | def manhattanDistance( xy1, xy2 ): class Counter (line 215) | class Counter(dict): method __getitem__ (line 255) | def __getitem__(self, idx): method incrementAll (line 259) | def incrementAll(self, keys, count): method argMax (line 273) | def argMax(self): method sortedKeys (line 283) | def sortedKeys(self): method totalCount (line 300) | def totalCount(self): method normalize (line 306) | def normalize(self): method divideAll (line 318) | def divideAll(self, divisor): method copy (line 326) | def copy(self): method __mul__ (line 332) | def __mul__(self, y ): method __radd__ (line 358) | def __radd__(self, y): method __add__ (line 376) | def __add__( self, y ): method __sub__ (line 402) | def __sub__( self, y ): function raiseNotDefined (line 428) | def raiseNotDefined(): function normalize (line 436) | def normalize(vectorOrCounter): function nSample (line 455) | def nSample(distribution, values, n): function sample (line 471) | def sample(distribution, values = None): function sampleFromCounter (line 485) | def sampleFromCounter(ctr): function getProbability (line 489) | def getProbability(value, distribution, values): function flipCoin (line 500) | def flipCoin( p ): function chooseFromDistribution (line 504) | def chooseFromDistribution( distribution ): function nearestPoint (line 514) | def nearestPoint( pos ): function sign (line 524) | def sign( x ): function arrayInvert (line 533) | def arrayInvert(array): function matrixAsList (line 543) | def matrixAsList( matrix, value = True ): function lookup (line 555) | def lookup(name, namespace): function pause (line 573) | def pause(): class TimeoutFunctionException (line 591) | class TimeoutFunctionException(Exception): class TimeoutFunction (line 596) | class TimeoutFunction: method __init__ (line 597) | def __init__(self, function, timeout): method handle_timeout (line 601) | def handle_timeout(self, signum, frame): method __call__ (line 604) | def __call__(self, *args, **keyArgs): class WritableNull (line 630) | class WritableNull: method write (line 631) | def write(self, string): function mutePrint (line 634) | def mutePrint(): function unmutePrint (line 645) | def unmutePrint(): FILE: Project-5/answers.py function q2 (line 15) | def q2(): FILE: Project-5/autograder.py function readCommand (line 31) | def readCommand(argv): function confirmGenerate (line 83) | def confirmGenerate(): function setModuleName (line 100) | def setModuleName(module, filename): function loadModuleString (line 118) | def loadModuleString(moduleSource): function loadModuleFile (line 131) | def loadModuleFile(moduleName, filePath): function readFile (line 136) | def readFile(path, root=""): function splitStrings (line 173) | def splitStrings(d): function printTest (line 184) | def printTest(testDict, solutionDict): function runTest (line 194) | def runTest(testName, moduleDict, printTestCase=False, display=None): function getDepends (line 219) | def getDepends(testParser, testRoot, question): function getTestSubdirs (line 230) | def getTestSubdirs(testParser, testRoot, questionToGrade): function evaluate (line 243) | def evaluate(generateSolutions, testRoot, moduleDict, exceptionMap=ERROR... function getDisplay (line 310) | def getDisplay(graphicsByDefault, options=None): FILE: Project-5/classificationAgents.py class DummyOptions (line 37) | class DummyOptions: method __init__ (line 38) | def __init__(self): class ClassifierAgent (line 48) | class ClassifierAgent(Agent): method __init__ (line 49) | def __init__(self, trainingData=None, validationData=None, classifierT... method getAction (line 66) | def getAction(self, state): function scoreEvaluation (line 74) | def scoreEvaluation(state): FILE: Project-5/classificationMethod.py class ClassificationMethod (line 17) | class ClassificationMethod: method __init__ (line 29) | def __init__(self, legalLabels): method train (line 37) | def train(self, trainingData, trainingLabels, validationData, validati... method classify (line 54) | def classify(self, data): FILE: Project-5/classificationTestClasses.py function readDigitData (line 47) | def readDigitData(trainingSize=100, testSize=100): function readSuicideData (line 66) | def readSuicideData(trainingSize=100, testSize=100): function readContestData (line 76) | def readContestData(trainingSize=100, testSize=100): function tinyDataSet (line 93) | def tinyDataSet(): function tinyDataSetPeceptronAndMira (line 113) | def tinyDataSetPeceptronAndMira(): function getAccuracy (line 155) | def getAccuracy(data, classifier, featureFunction=dataClassifier.basicFe... class GradeClassifierTest (line 170) | class GradeClassifierTest(testClasses.TestCase): method __init__ (line 172) | def __init__(self, question, testDict): method grade_classifier (line 190) | def grade_classifier(self, moduleDict): method execute (line 208) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 238) | def writeSolution(self, moduleDict, filePath): class MultipleChoiceTest (line 252) | class MultipleChoiceTest(testClasses.TestCase): method __init__ (line 254) | def __init__(self, question, testDict): method execute (line 259) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 269) | def writeSolution(self, moduleDict, filePath): FILE: Project-5/dataClassifier.py function basicFeatureExtractorDigit (line 35) | def basicFeatureExtractorDigit(datum): function basicFeatureExtractorFace (line 51) | def basicFeatureExtractorFace(datum): function enhancedFeatureExtractorDigit (line 67) | def enhancedFeatureExtractorDigit(datum): function basicFeatureExtractorPacman (line 137) | def basicFeatureExtractorPacman(state): function enhancedFeatureExtractorPacman (line 155) | def enhancedFeatureExtractorPacman(state): function enhancedPacmanFeatures (line 170) | def enhancedPacmanFeatures(state, action): function contestFeatureExtractorDigit (line 206) | def contestFeatureExtractorDigit(datum): function enhancedFeatureExtractorFace (line 213) | def enhancedFeatureExtractorFace(datum): function analysis (line 221) | def analysis(classifier, guesses, testLabels, testData, rawTestData, pri... class ImagePrinter (line 261) | class ImagePrinter: method __init__ (line 262) | def __init__(self, width, height): method printImage (line 266) | def printImage(self, pixels): function default (line 289) | def default(str): function readCommand (line 307) | def readCommand( argv ): function runClassifier (line 438) | def runClassifier(args, options): FILE: Project-5/game.py class Agent (line 32) | class Agent: method __init__ (line 39) | def __init__(self, index=0): method getAction (line 42) | def getAction(self, state): class Directions (line 49) | class Directions: class Configuration (line 70) | class Configuration: method __init__ (line 79) | def __init__(self, pos, direction): method getPosition (line 83) | def getPosition(self): method getDirection (line 86) | def getDirection(self): method isInteger (line 89) | def isInteger(self): method __eq__ (line 93) | def __eq__(self, other): method __hash__ (line 97) | def __hash__(self): method __str__ (line 102) | def __str__(self): method generateSuccessor (line 105) | def generateSuccessor(self, vector): class AgentState (line 120) | class AgentState: method __init__ (line 125) | def __init__( self, startConfiguration, isPacman ): method __str__ (line 133) | def __str__( self ): method __eq__ (line 139) | def __eq__( self, other ): method __hash__ (line 144) | def __hash__(self): method copy (line 147) | def copy( self ): method getPosition (line 155) | def getPosition(self): method getDirection (line 159) | def getDirection(self): class Grid (line 162) | class Grid: method __init__ (line 170) | def __init__(self, width, height, initialValue=False, bitRepresentatio... method __getitem__ (line 180) | def __getitem__(self, i): method __setitem__ (line 183) | def __setitem__(self, key, item): method __str__ (line 186) | def __str__(self): method __eq__ (line 191) | def __eq__(self, other): method __hash__ (line 195) | def __hash__(self): method copy (line 206) | def copy(self): method deepCopy (line 211) | def deepCopy(self): method shallowCopy (line 214) | def shallowCopy(self): method count (line 219) | def count(self, item =True ): method asList (line 222) | def asList(self, key = True): method packBits (line 229) | def packBits(self): method _cellIndexToPosition (line 248) | def _cellIndexToPosition(self, index): method _unpackBits (line 253) | def _unpackBits(self, bits): method _unpackInt (line 265) | def _unpackInt(self, packed, size): function reconstituteGrid (line 277) | def reconstituteGrid(bitRep): class Actions (line 287) | class Actions: method reverseDirection (line 302) | def reverseDirection(action): method vectorToDirection (line 314) | def vectorToDirection(vector): method directionToVector (line 327) | def directionToVector(direction, speed = 1.0): method getPossibleActions (line 332) | def getPossibleActions(config, walls): method getLegalNeighbors (line 351) | def getLegalNeighbors(position, walls): method getSuccessor (line 365) | def getSuccessor(position, action): class GameStateData (line 371) | class GameStateData: method __init__ (line 375) | def __init__( self, prevState = None ): method deepCopy (line 395) | def deepCopy( self ): method copyAgentStates (line 405) | def copyAgentStates( self, agentStates ): method __eq__ (line 411) | def __eq__( self, other ): method __hash__ (line 423) | def __hash__( self ): method __str__ (line 435) | def __str__( self ): method _foodWallStr (line 460) | def _foodWallStr( self, hasFood, hasWall ): method _pacStr (line 468) | def _pacStr( self, dir ): method _ghostStr (line 477) | def _ghostStr( self, dir ): method initialize (line 487) | def initialize( self, layout, numGhostAgents ): class Game (line 513) | class Game: method __init__ (line 518) | def __init__( self, agents, display, rules, startingIndex=0, muteAgent... method getProgress (line 534) | def getProgress(self): method _agentCrash (line 540) | def _agentCrash( self, agentIndex, quiet=False): method mute (line 550) | def mute(self, agentIndex): method unmute (line 559) | def unmute(self): method run (line 567) | def run( self ): FILE: Project-5/ghostAgents.py class GhostAgent (line 22) | class GhostAgent( Agent ): method __init__ (line 23) | def __init__( self, index ): method getAction (line 26) | def getAction( self, state ): method getDistribution (line 33) | def getDistribution(self, state): class RandomGhost (line 37) | class RandomGhost( GhostAgent ): method getDistribution (line 39) | def getDistribution( self, state ): class DirectionalGhost (line 45) | class DirectionalGhost( GhostAgent ): method __init__ (line 47) | def __init__( self, index, prob_attack=0.8, prob_scaredFlee=0.8 ): method getDistribution (line 52) | def getDistribution( self, state ): FILE: Project-5/grading.py class Grades (line 25) | class Grades: method __init__ (line 27) | def __init__(self, projectName, questionsAndMaxesList, edxOutput=False... method addPrereq (line 48) | def addPrereq(self, question, prereq): method grade (line 51) | def grade(self, gradingModule, exceptionMap = {}, bonusPic = False): method addExceptionMessage (line 139) | def addExceptionMessage(self, q, inst, traceback): method addErrorHints (line 149) | def addErrorHints(self, exceptionMap, errorInstance, questionNum): method produceOutput (line 171) | def produceOutput(self): method fail (line 227) | def fail(self, message, raw=False): method assignZeroCredit (line 233) | def assignZeroCredit(self): method addPoints (line 236) | def addPoints(self, amt): method deductPoints (line 239) | def deductPoints(self, amt): method assignFullCredit (line 242) | def assignFullCredit(self, message="", raw=False): method addMessage (line 247) | def addMessage(self, message, raw=False): method addMessageToEmail (line 256) | def addMessageToEmail(self, message): class Counter (line 267) | class Counter(dict): method __getitem__ (line 271) | def __getitem__(self, idx): method totalCount (line 277) | def totalCount(self): FILE: Project-5/graphicsDisplay.py class InfoPane (line 82) | class InfoPane: method __init__ (line 83) | def __init__(self, layout, gridSize): method toScreen (line 92) | def toScreen(self, pos, y = None): method drawPane (line 105) | def drawPane(self): method initializeGhostDistances (line 108) | def initializeGhostDistances(self, distances): method updateScore (line 121) | def updateScore(self, score): method setTeam (line 124) | def setTeam(self, isBlue): method updateGhostDistances (line 129) | def updateGhostDistances(self, distances): method drawGhost (line 136) | def drawGhost(self): method drawPacman (line 139) | def drawPacman(self): method drawWarning (line 142) | def drawWarning(self): method clearIcon (line 145) | def clearIcon(self): method updateMessage (line 148) | def updateMessage(self, message): method clearMessage (line 151) | def clearMessage(self): class PacmanGraphics (line 155) | class PacmanGraphics: method __init__ (line 156) | def __init__(self, zoom=1.0, frameTime=0.0, capture=False): method checkNullDisplay (line 165) | def checkNullDisplay(self): method initialize (line 168) | def initialize(self, state, isBlue = False): method startGraphics (line 180) | def startGraphics(self, state): method drawDistributions (line 189) | def drawDistributions(self, state): method drawStaticObjects (line 204) | def drawStaticObjects(self, state): method drawAgentObjects (line 211) | def drawAgentObjects(self, state): method swapImages (line 222) | def swapImages(self, agentIndex, newState): method update (line 236) | def update(self, newState): method make_window (line 256) | def make_window(self, width, height): method drawPacman (line 267) | def drawPacman(self, pacman, index): method getEndpoints (line 286) | def getEndpoints(self, direction, position=(0,0)): method movePacman (line 302) | def movePacman(self, position, direction, image): method animatePacman (line 309) | def animatePacman(self, pacman, prevPacman, image): method getGhostColor (line 329) | def getGhostColor(self, ghost, ghostIndex): method drawGhost (line 335) | def drawGhost(self, ghost, agentIndex): method moveEyes (line 371) | def moveEyes(self, pos, dir, eyes): method moveGhost (line 388) | def moveGhost(self, ghost, ghostIndex, prevGhost, ghostImageParts): method getPosition (line 405) | def getPosition(self, agentState): method getDirection (line 409) | def getDirection(self, agentState): method finish (line 413) | def finish(self): method to_screen (line 416) | def to_screen(self, point): method to_screen2 (line 424) | def to_screen2(self, point): method drawWalls (line 431) | def drawWalls(self, wallMatrix): method isWall (line 517) | def isWall(self, x, y, walls): method drawFood (line 524) | def drawFood(self, foodMatrix ): method drawCapsules (line 544) | def drawCapsules(self, capsules ): method removeFood (line 556) | def removeFood(self, cell, foodImages ): method removeCapsule (line 560) | def removeCapsule(self, cell, capsuleImages ): method drawExpandedCells (line 564) | def drawExpandedCells(self, cells): method clearExpandedCells (line 583) | def clearExpandedCells(self): method updateDistributions (line 589) | def updateDistributions(self, distributions): class FirstPersonPacmanGraphics (line 611) | class FirstPersonPacmanGraphics(PacmanGraphics): method __init__ (line 612) | def __init__(self, zoom = 1.0, showGhosts = True, capture = False, fra... method initialize (line 617) | def initialize(self, state, isBlue = False): method lookAhead (line 634) | def lookAhead(self, config, state): method getGhostColor (line 648) | def getGhostColor(self, ghost, ghostIndex): method getPosition (line 651) | def getPosition(self, ghostState): function add (line 657) | def add(x, y): function saveFrame (line 672) | def saveFrame(): FILE: Project-5/graphicsUtils.py function formatColor (line 35) | def formatColor(r, g, b): function colorToVector (line 38) | def colorToVector(color): function sleep (line 47) | def sleep(secs): function begin_graphics (line 56) | def begin_graphics(width=640, height=480, color=formatColor(0, 0, 0), ti... function _leftclick (line 101) | def _leftclick(event): function _rightclick (line 105) | def _rightclick(event): function _ctrl_leftclick (line 109) | def _ctrl_leftclick(event): function wait_for_click (line 113) | def wait_for_click(): function draw_background (line 132) | def draw_background(): function _destroy_window (line 136) | def _destroy_window(event=None): function end_graphics (line 143) | def end_graphics(): function clear_screen (line 158) | def clear_screen(background=None): function polygon (line 164) | def polygon(coords, outlineColor, fillColor=None, filled=1, smoothed=1, ... function square (line 176) | def square(pos, r, color, filled=1, behind=0): function circle (line 181) | def circle(pos, r, outlineColor, fillColor, endpoints=None, style='piesl... function image (line 194) | def image(pos, file="../../blueghost.gif"): function refresh (line 200) | def refresh(): function moveCircle (line 203) | def moveCircle(id, pos, r, endpoints=None): function edit (line 220) | def edit(id, *args): function text (line 223) | def text(pos, color, contents, font='Helvetica', size=12, style='normal'... function changeText (line 229) | def changeText(id, newText, font=None, size=12, style='normal'): function changeColor (line 234) | def changeColor(id, newColor): function line (line 237) | def line(here, there, color=formatColor(0, 0, 0), width=2): function _keypress (line 254) | def _keypress(event): function _keyrelease (line 262) | def _keyrelease(event): function remap_arrows (line 271) | def remap_arrows(event): function _clear_keys (line 284) | def _clear_keys(event=None): function keys_pressed (line 290) | def keys_pressed(d_o_e=Tkinter.tkinter.dooneevent, function keys_waiting (line 297) | def keys_waiting(): function wait_for_keys (line 305) | def wait_for_keys(): function remove_from_screen (line 312) | def remove_from_screen(x, function _adjust_coords (line 318) | def _adjust_coords(coord_list, x, y): function move_to (line 324) | def move_to(object, x, y=None, function move_by (line 346) | def move_by(object, x, y=None, function writePostscript (line 369) | def writePostscript(filename): FILE: Project-5/keyboardAgents.py class KeyboardAgent (line 19) | class KeyboardAgent(Agent): method __init__ (line 30) | def __init__( self, index = 0 ): method getAction (line 36) | def getAction( self, state): method getMove (line 59) | def getMove(self, legal): class KeyboardAgent2 (line 67) | class KeyboardAgent2(KeyboardAgent): method getMove (line 78) | def getMove(self, legal): FILE: Project-5/layout.py class Layout (line 22) | class Layout: method __init__ (line 27) | def __init__(self, layoutText): method getNumGhosts (line 40) | def getNumGhosts(self): method initializeVisibilityMatrix (line 43) | def initializeVisibilityMatrix(self): method isWall (line 64) | def isWall(self, pos): method getRandomLegalPosition (line 68) | def getRandomLegalPosition(self): method getRandomCorner (line 76) | def getRandomCorner(self): method getFurthestCorner (line 80) | def getFurthestCorner(self, pacPos): method isVisibleFrom (line 85) | def isVisibleFrom(self, ghostPos, pacPos, pacDirection): method __str__ (line 89) | def __str__(self): method deepCopy (line 92) | def deepCopy(self): method processLayoutText (line 95) | def processLayoutText(self, layoutText): method processLayoutChar (line 116) | def processLayoutChar(self, x, y, layoutChar): function getLayout (line 131) | def getLayout(name, back = 2): function tryToLoad (line 145) | def tryToLoad(fullname): FILE: Project-5/mira.py class MiraClassifier (line 19) | class MiraClassifier: method __init__ (line 26) | def __init__( self, legalLabels, max_iterations): method initializeWeightsToZero (line 35) | def initializeWeightsToZero(self): method train (line 41) | def train(self, trainingData, trainingLabels, validationData, validati... method trainAndTune (line 53) | def trainAndTune(self, trainingData, trainingLabels, validationData, v... method classify (line 90) | def classify(self, data ): FILE: Project-5/mostFrequent.py class MostFrequentClassifier (line 18) | class MostFrequentClassifier(classificationMethod.ClassificationMethod): method __init__ (line 24) | def __init__(self, legalLabels): method train (line 28) | def train(self, data, labels, validationData, validationLabels): method classify (line 36) | def classify(self, testData): FILE: Project-5/naiveBayes.py class NaiveBayesClassifier (line 19) | class NaiveBayesClassifier(classificationMethod.ClassificationMethod): method __init__ (line 26) | def __init__(self, legalLabels): method setSmoothing (line 32) | def setSmoothing(self, k): method train (line 39) | def train(self, trainingData, trainingLabels, validationData, validati... method trainAndTune (line 55) | def trainAndTune(self, trainingData, trainingLabels, validationData, v... method classify (line 126) | def classify(self, testData): method calculateLogJointProbabilities (line 140) | def calculateLogJointProbabilities(self, datum): method findHighOddsFeatures (line 161) | def findHighOddsFeatures(self, label1, label2): FILE: Project-5/pacman.py class GameState (line 55) | class GameState: method getAndResetExplored (line 76) | def getAndResetExplored(): method getLegalActions (line 82) | def getLegalActions( self, agentIndex=0 ): method generateSuccessor (line 94) | def generateSuccessor( self, agentIndex, action): method getLegalPacmanActions (line 127) | def getLegalPacmanActions( self ): method generatePacmanSuccessor (line 130) | def generatePacmanSuccessor( self, action ): method getPacmanState (line 136) | def getPacmanState( self ): method getPacmanPosition (line 145) | def getPacmanPosition( self ): method getGhostStates (line 148) | def getGhostStates( self ): method getGhostState (line 151) | def getGhostState( self, agentIndex ): method getGhostPosition (line 156) | def getGhostPosition( self, agentIndex ): method getGhostPositions (line 161) | def getGhostPositions(self): method getNumAgents (line 164) | def getNumAgents( self ): method getScore (line 167) | def getScore( self ): method getCapsules (line 170) | def getCapsules(self): method getNumFood (line 176) | def getNumFood( self ): method getFood (line 179) | def getFood(self): method getWalls (line 191) | def getWalls(self): method hasFood (line 203) | def hasFood(self, x, y): method hasWall (line 206) | def hasWall(self, x, y): method isLose (line 209) | def isLose( self ): method isWin (line 212) | def isWin( self ): method __init__ (line 220) | def __init__( self, prevState = None ): method deepCopy (line 229) | def deepCopy( self ): method __eq__ (line 234) | def __eq__( self, other ): method __hash__ (line 240) | def __hash__( self ): method __str__ (line 246) | def __str__( self ): method initialize (line 250) | def initialize( self, layout, numGhostAgents=1000 ): class ClassicGameRules (line 266) | class ClassicGameRules: method __init__ (line 271) | def __init__(self, timeout=30): method newGame (line 274) | def newGame( self, layout, pacmanAgent, ghostAgents, display, quiet = ... method process (line 284) | def process(self, state, game): method win (line 291) | def win( self, state, game ): method lose (line 295) | def lose( self, state, game ): method getProgress (line 299) | def getProgress(self, game): method agentCrash (line 302) | def agentCrash(self, game, agentIndex): method getMaxTotalTime (line 308) | def getMaxTotalTime(self, agentIndex): method getMaxStartupTime (line 311) | def getMaxStartupTime(self, agentIndex): method getMoveWarningTime (line 314) | def getMoveWarningTime(self, agentIndex): method getMoveTimeout (line 317) | def getMoveTimeout(self, agentIndex): method getMaxTimeWarnings (line 320) | def getMaxTimeWarnings(self, agentIndex): class PacmanRules (line 323) | class PacmanRules: method getLegalActions (line 330) | def getLegalActions( state ): method applyAction (line 337) | def applyAction( state, action ): method consume (line 359) | def consume( position, state ): class GhostRules (line 381) | class GhostRules: method getLegalActions (line 386) | def getLegalActions( state, ghostIndex ): method applyAction (line 401) | def applyAction( state, action, ghostIndex): method decrementTimer (line 414) | def decrementTimer( ghostState): method checkDeath (line 421) | def checkDeath( state, agentIndex): method collide (line 436) | def collide( state, ghostState, agentIndex): method canKill (line 449) | def canKill( pacmanPosition, ghostPosition ): method placeGhost (line 453) | def placeGhost(state, ghostState): function default (line 461) | def default(str): function parseAgentArgs (line 464) | def parseAgentArgs(str): function readCommand (line 476) | def readCommand( argv ): function loadAgent (line 587) | def loadAgent(pacman, nographics): function replayGame (line 610) | def replayGame( layout, actions, display ): function runGames (line 628) | def runGames( layout, pacman, ghosts, display, numGames, record, numTrai... FILE: Project-5/pacmanAgents.py class LeftTurnAgent (line 21) | class LeftTurnAgent(game.Agent): method getAction (line 24) | def getAction(self, state): class GreedyAgent (line 35) | class GreedyAgent(Agent): method __init__ (line 36) | def __init__(self, evalFn="scoreEvaluation"): method getAction (line 40) | def getAction(self, state): function scoreEvaluation (line 51) | def scoreEvaluation(state): FILE: Project-5/perceptron.py class PerceptronClassifier (line 19) | class PerceptronClassifier: method __init__ (line 26) | def __init__( self, legalLabels, max_iterations): method setWeights (line 34) | def setWeights(self, weights): method train (line 38) | def train( self, trainingData, trainingLabels, validationData, validat... method classify (line 63) | def classify(self, data ): method findHighWeightFeatures (line 79) | def findHighWeightFeatures(self, label): FILE: Project-5/perceptron_pacman.py class PerceptronClassifierPacman (line 23) | class PerceptronClassifierPacman(PerceptronClassifier): method __init__ (line 24) | def __init__(self, legalLabels, maxIterations): method classify (line 28) | def classify(self, data ): method train (line 44) | def train( self, trainingData, trainingLabels, validationData, validat... FILE: Project-5/samples.py class Datum (line 23) | class Datum: method __init__ (line 59) | def __init__(self, data,width,height): method getPixel (line 71) | def getPixel(self, column, row): method getPixels (line 77) | def getPixels(self): method getAsciiString (line 83) | def getAsciiString(self): method __str__ (line 94) | def __str__(self): function loadDataFile (line 101) | def loadDataFile(filename, n,width,height): function readlines (line 125) | def readlines(filename): function loadLabelsFile (line 133) | def loadLabelsFile(filename, n): function loadPacmanStatesFile (line 145) | def loadPacmanStatesFile(filename, n): function loadPacmanData (line 156) | def loadPacmanData(filename, n): function asciiGrayscaleConversionFunction (line 163) | def asciiGrayscaleConversionFunction(value): function IntegerConversionFunction (line 174) | def IntegerConversionFunction(character): function convertToInteger (line 185) | def convertToInteger(data): function _test (line 196) | def _test(): FILE: Project-5/testClasses.py class Question (line 24) | class Question(object): method raiseNotDefined (line 26) | def raiseNotDefined(self): method __init__ (line 30) | def __init__(self, questionDict, display): method getDisplay (line 35) | def getDisplay(self): method getMaxPoints (line 38) | def getMaxPoints(self): method addTestCase (line 43) | def addTestCase(self, testCase, thunk): method execute (line 46) | def execute(self, grades): class PassAllTestsQuestion (line 50) | class PassAllTestsQuestion(Question): method execute (line 52) | def execute(self, grades): class HackedPartialCreditQuestion (line 67) | class HackedPartialCreditQuestion(Question): method execute (line 69) | def execute(self, grades): class Q6PartialCreditQuestion (line 89) | class Q6PartialCreditQuestion(Question): method execute (line 93) | def execute(self, grades): class PartialCreditQuestion (line 102) | class PartialCreditQuestion(Question): method execute (line 106) | def execute(self, grades): class NumberPassedQuestion (line 117) | class NumberPassedQuestion(Question): method execute (line 120) | def execute(self, grades): class TestCase (line 128) | class TestCase(object): method raiseNotDefined (line 130) | def raiseNotDefined(self): method getPath (line 134) | def getPath(self): method __init__ (line 137) | def __init__(self, question, testDict): method __str__ (line 143) | def __str__(self): method execute (line 146) | def execute(self, grades, moduleDict, solutionDict): method writeSolution (line 149) | def writeSolution(self, moduleDict, filePath): method testPass (line 159) | def testPass(self, grades): method testFail (line 165) | def testFail(self, grades): method testPartial (line 173) | def testPartial(self, grades, points, maxPoints): method addMessage (line 187) | def addMessage(self, message): FILE: Project-5/testParser.py class TestParser (line 18) | class TestParser(object): method __init__ (line 20) | def __init__(self, path): method removeComments (line 24) | def removeComments(self, rawlines): method parse (line 35) | def parse(self): function emitTestDict (line 76) | def emitTestDict(testDict, handle): FILE: Project-5/textDisplay.py class NullGraphics (line 26) | class NullGraphics: method initialize (line 27) | def initialize(self, state, isBlue = False): method update (line 30) | def update(self, state): method checkNullDisplay (line 33) | def checkNullDisplay(self): method pause (line 36) | def pause(self): method draw (line 39) | def draw(self, state): method updateDistributions (line 42) | def updateDistributions(self, dist): method finish (line 45) | def finish(self): class PacmanGraphics (line 48) | class PacmanGraphics: method __init__ (line 49) | def __init__(self, speed=None): method initialize (line 54) | def initialize(self, state, isBlue = False): method update (line 60) | def update(self, state): method pause (line 74) | def pause(self): method draw (line 77) | def draw(self, state): method finish (line 80) | def finish(self): FILE: Project-5/util.py class FixedRandom (line 21) | class FixedRandom: method __init__ (line 22) | def __init__(self): class Stack (line 120) | class Stack: method __init__ (line 122) | def __init__(self): method push (line 125) | def push(self,item): method pop (line 129) | def pop(self): method isEmpty (line 133) | def isEmpty(self): class Queue (line 137) | class Queue: method __init__ (line 139) | def __init__(self): method push (line 142) | def push(self,item): method pop (line 146) | def pop(self): method isEmpty (line 153) | def isEmpty(self): class PriorityQueue (line 157) | class PriorityQueue: method __init__ (line 168) | def __init__(self): method push (line 172) | def push(self, item, priority): method pop (line 180) | def pop(self): method isEmpty (line 185) | def isEmpty(self): class PriorityQueueWithFunction (line 188) | class PriorityQueueWithFunction(PriorityQueue): method __init__ (line 195) | def __init__(self, priorityFunction): method push (line 200) | def push(self, item): function manhattanDistance (line 205) | def manhattanDistance( xy1, xy2 ): class Counter (line 215) | class Counter(dict): method __getitem__ (line 255) | def __getitem__(self, idx): method incrementAll (line 259) | def incrementAll(self, keys, count): method argMax (line 273) | def argMax(self): method sortedKeys (line 283) | def sortedKeys(self): method totalCount (line 300) | def totalCount(self): method normalize (line 306) | def normalize(self): method divideAll (line 318) | def divideAll(self, divisor): method copy (line 326) | def copy(self): method __mul__ (line 332) | def __mul__(self, y ): method __radd__ (line 358) | def __radd__(self, y): method __add__ (line 376) | def __add__( self, y ): method __sub__ (line 402) | def __sub__( self, y ): function raiseNotDefined (line 428) | def raiseNotDefined(): function normalize (line 436) | def normalize(vectorOrCounter): function nSample (line 455) | def nSample(distribution, values, n): function sample (line 471) | def sample(distribution, values = None): function sampleFromCounter (line 485) | def sampleFromCounter(ctr): function getProbability (line 489) | def getProbability(value, distribution, values): function flipCoin (line 500) | def flipCoin( p ): function chooseFromDistribution (line 504) | def chooseFromDistribution( distribution ): function nearestPoint (line 514) | def nearestPoint( pos ): function sign (line 524) | def sign( x ): function arrayInvert (line 533) | def arrayInvert(array): function matrixAsList (line 543) | def matrixAsList( matrix, value = True ): function lookup (line 555) | def lookup(name, namespace): function pause (line 573) | def pause(): class TimeoutFunctionException (line 591) | class TimeoutFunctionException(Exception): class TimeoutFunction (line 596) | class TimeoutFunction: method __init__ (line 597) | def __init__(self, function, timeout): method handle_timeout (line 601) | def handle_timeout(self, signum, frame): method __call__ (line 604) | def __call__(self, *args, **keyArgs): class WritableNull (line 630) | class WritableNull: method write (line 631) | def write(self, string): function mutePrint (line 634) | def mutePrint(): function unmutePrint (line 645) | def unmutePrint():