int(input("Please input the depth you want: ")))) if (game_mode) == 2: oh.A_star_solve( manual_scramble(), int(input("Please input number of steps you want: ")), int(input("Please input the depth you want: "))) #input parameters if (game_mode) == 3: state = manual_scramble() scramble_depth = int( input("\nPlease input the module you want to load: ")) depth = int(input("\nPlease input the number of depth: ")) steps = int(input("\nPlease input the number of steps: ")) node = gr.Node(state, depth, steps) #import trained nn net = nn.RubikNet() net.load_state_dict(tr.load("model_%d.pth" % scramble_depth)) for step in range(steps): print("Turn %d" % step) #check goal if node.match == 27: print("\nSolve") print("Path is :") print(node.path) #node.state.disp() break #check if have goal in the pool of children, in-other word, check the size of heuristic, it has the goal or not #search if there is a result in the heuristic
r_A_nn = list() for game in range(num_games): scramble = gr.scramble(scramble_depth) #random choice print("\nCalculate random process game: %d" % game) r_rand.append(oh.random_process_score(scramble, (depth * steps))) #r_rand.append(oh.random_process_score(gr.scramble(scramble_depth), (depth*steps))) #A* choice print("\nCalculate A* game: %d" % game) r_A.append(oh.A_star_solve_score(scramble, steps, depth)) #r_A.append(oh.A_star_solve_score(gr.scramble(scramble_depth), steps, depth)) #A*_NN choice print("\nCalculate A*_NN game: %d" % game) node = gr.Node(scramble, depth, steps) #node = gr.Node(gr.scramble(scramble_depth), depth, steps) for step in range(steps): #check goal if node.match == 8: break #check if have goal in the pool of children, in-other word, check the size of heuristic, it has the goal or not #search if there is a result in the heuristic ind = gr.make_choice(node) #check goal in last step if node.children()[ind].match == 8: node = node.children()[ind] break #no goal in the poll of children #nn_searching