def Trace_Performance_Comparison_Search_Algorithms(): default_cube = rubiks_cube.Get_Default_Cube() scrambled_cube_with_turns_executed = rubiks_cube.Get_Scrambled_Cube( default_cube.copy(), 1) bfs_path_cost, bfs_execution_time = Trace_Rubiks_Cube_Breadth_First_Search( scrambled_cube_with_turns_executed.copy()) bis_path_cost, bis_execution_time = Trace_Rubiks_Cube_Bidirectional_Search( scrambled_cube_with_turns_executed.copy()) dfs_path_cost, dfs_execution_time = Trace_Rubiks_Cube_Depth_First_Search( scrambled_cube_with_turns_executed.copy())
def Get_Number_Of_Correct_Cube_Centers( cube, default_cube=rubiks_cube.Get_Default_Cube()): number_of_correct_cube_centers = 0 cube_side_centers = Get_Cube_Side_Centers(cube) default_cube_side_centers = Get_Cube_Side_Centers(default_cube) for cube_side in cube_side_centers.keys(): if cube_side_centers[cube_side] == default_cube_side_centers[ cube_side]: number_of_correct_cube_centers = number_of_correct_cube_centers + 1 return number_of_correct_cube_centers
def Get_Default_Rubiks_Cube_Search_Tree(): cube_search_tree = {} default_cube = rubiks_cube.Get_Default_Cube() turn_options = rubiks_cube.Get_Rubiks_Cube_Turns_List() cube_search_tree = { "CURRENT_CUBE": default_cube.copy(), "ROOT_CUBE": default_cube.copy(), "GOAL_CUBE": None, "TURN_OPTIONS": turn_options.copy(), "OPEN_STATES": [], "CLOSED_STATES": [], "PATH_COST": 0 } return cube_search_tree
def Get_New_Rubiks_Cube_Search_Tree(): cube_search_tree = {} default_cube = rubiks_cube.Get_Default_Cube() scrambled_cube_with_turns_exectuted = rubiks_cube.Get_Scrambled_Cube( default_cube.copy(), 4) scrambled_cube = scrambled_cube_with_turns_exectuted["CUBE"] scramble_turns = scrambled_cube_with_turns_exectuted["TURNS_EXECUTED"] turn_options = rubiks_cube.Get_Rubiks_Cube_Turns_List() cube_search_tree = { "CURRENT_CUBE": scrambled_cube.copy(), "ROOT_CUBE": scrambled_cube.copy(), "ROOT_CUBE_TURNS_EXECUTED": scramble_turns, "GOAL_CUBE": default_cube.copy(), "TURN_OPTIONS": turn_options.copy(), "OPEN_STATES": [], "CLOSED_STATES": [], "PATH_COST": 0 } return cube_search_tree
def Trace_Rubiks_Cube_Genetic_Algorithm(): default_cube = rubiks_cube.Get_Default_Cube() scrambled_cube = rubiks_cube.Get_Scrambled_Cube(default_cube, num_turns=20)["CUBE"] rubiks_cube.Print_Cube(scrambled_cube)
def Get_Number_Of_Correct_Cube_Block_Edges( cube, default_cube=rubiks_cube.Get_Default_Cube()): number_of_correct_cube_block_edges = 0 return number_of_correct_cube_block_edges