示例#1
0
def test_4():
    # Grid format:
    #   0 = Navigable space
    #   1 = Occupied space

    grid = [[0, 1], [0, 0]]
    init = [0, 0]
    goal = [len(grid) - 1, len(grid[0]) - 1]
    cost = 1

    print(search(grid, init, goal, cost))
示例#2
0
def test_7():
    # Grid format:
    #   0 = Navigable space
    #   1 = Occupied space

    grid = [[0, 1, 1, 1, 1], [0, 1, 0, 0, 0], [0, 0, 0, 1, 0], [1, 1, 1, 1, 0],
            [0, 0, 0, 1, 0]]
    init = [0, 0]
    goal = [len(grid) - 1, len(grid[0]) - 1]
    cost = 1

    print('-------------------------------------')
    expand = search(grid, init, goal, cost)

    for row in expand:
        print(row)