-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsokoban.py
25 lines (23 loc) · 928 Bytes
/
sokoban.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
from board import Board
from game import Game
def main():
print("Enter sokoban board file number (example: 01) from input_files folder: ")
number = input()
# print('-'*20)
boardInputFile = os.path.join(os.getcwd(), 'input_files', 'sokoban'+str(number)+'.txt')
assert os.path.isfile(boardInputFile)
sokobanBoard = Board(boardInputFile)
game = Game(sokobanBoard)
# print('-'*20)
# game.play_moves(['r', 'r', 'd', 'd', 'd', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'u', 'L',
# 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'u', 'l', 'D', 'D', 'D', 'D', 'r', 'd', 'L'])
print(game.play_AStar())
# print(game.play_AStar_fix_f())
# print(game.play_IDAStar())
# print('Tree Depth: {}, Average Branching Factor: {}'.format(game.solutionDepth, game.branchingFactor))
# moves = list('rDlddrrruuLLrrddllUdrruulullDRddl')
# print(len(moves))
# game.play_moves(moves)
if __name__ == '__main__':
main()