Beispiel #1
0
    [0, 12, 3, 0, 0],
    [0, 13, 0, 0, 0],
    [14, 0, 1, 0, 0],
]
# a 4x4 board with 1 as the smallest number, and 16 as the highest
hidatoBoard2 = [[0, 0, 0, 10], [14, 16, 0, 11], [0, 4, 8, 1], [5, 0, 0, 0]]
# a 5x5 board with 1 as the smallest number, and 25 as the highest
hidatoBoard3 = [
    [0, 0, 0, 0, 0],
    [0, 0, 12, 1, 2],
    [16, 0, 0, 10, 25],
    [0, 0, 0, 0, 24],
    [0, 0, 0, 21, 22],
]

heuristic = H.HidatoHeuristic()

start_time1 = time.time()

# example number 1
print("This is the first example given board:")
print('\n'.join(
    [''.join(['{:4}'.format(item) for item in row]) for row in hidatoBoard1]))

game1 = G.HidatoGame(hidatoBoard1, 1, 4, 2, heuristic=heuristic)
state0 = game1.getState()
dictOfStates[state0] = heuristic.H(state0)
solution1 = breadth_first_search(game1, state0)

print("This is the winning state board:")
print('\n'.join([