Example #1
0
def test_weighted(n):
    problem_file = "./warehouses/warehouse_%s.txt" % str(n)
    print(n, ": ", end="")
    wh = Warehouse()
    wh.load_warehouse(problem_file)
    time1 = time.time()
    solve_weighted_sokoban_elem(wh, [1 for box in wh.boxes])
    print('{:06.3f}s'.format(time.time() - time1))
Example #2
0
def test_solve_weighted_sokoban_elem():
    wh = Warehouse()    
    wh.load_warehouse( "./warehouses/cab320_warehouse_8.txt")
    # first test
    answer=solve_weighted_sokoban_elem(wh, [1,9])

    expected_answer = ['Up', 'Left', 'Up', 'Left', 'Left', 'Down', 'Left', 
                       'Down', 'Right', 'Right', 'Right', 'Up', 'Left', 'Up', 
                       'Left', 'Down', 'Right', 'Down', 'Left', 'Right', 
                       'Right', 'Right', 'Right', 'Right', 'Right', 'Right']
    fcn = test_solve_weighted_sokoban_elem
    print('<<  First test of {} >>'.format(fcn.__name__))
    if answer==expected_answer:
        print(fcn.__name__, ' answer as expected!  :-)\n')
    else:
        print(fcn.__name__, ' different answer!  :-(\n')
        print('Expected ');print(expected_answer)
        print('But, received ');print(answer)
        print('Your answer is different but it might still be correct')
        print('Check that you pushed the right box onto the left target!')