# alexband/Udacity-373

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (65 sloc) 2.28 KB
 # ---------- # User Instructions: # # Create a function compute_value() which returns # a grid of values. Value is defined as the minimum # number of moves required to get from a cell to the # goal. # # If it is impossible to reach the goal from a cell # you should assign that cell a value of 99. # ---------- grid = [[0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0]] init = [0, 0] goal = [len(grid)-1, len(grid[0])-1] delta = [[-1, 0 ], # go up [ 0, -1], # go left [ 1, 0 ], # go down [ 0, 1 ]] # go right delta_name = ['^', '<', 'v', '>'] cost_step = 1 # the cost associated with moving from a cell to an adjacent one. # ---------------------------------------- # insert code below # ---------------------------------------- def compute_value(): def motion(state, move, grid): row_index = state[0] + move[0] column_index = state[1] + move[1] if not 0<=row_index