How to solve an 8 puzzle problem using A* Algorithm in python
Two heuristics for an 8 puzzle problem GoalNode=[[7,2,4],[5,0,6],[8,3,1]] StartNode=[[0,1,2],[3,4,5],[6,7,8]] temp = [] h1 = -1 h2 = 0 print("Given StartNode is: ",StartNode) print("\n\n\t Given GoalNode is: ",GoalNode) print("\n\n######################################") for i in range(len(StartNode)): for j in range (len(StartNode)): if StartNode[i][j] != GoalNode[i][j]: h1+=1 print("\n\n\t h1 : Number of misplaced tiles =>",h1) print("\n\n######################################") print("\n\nDistances of the tiles from their goal positions are: \n") for i in range(len(StartNode)): for j in range (len(StartNode)): if (StartNode[i][j]==0): pass else: if (GoalNode[0][0] == StartNode[i][j]): temp.append(abs(i-0) + abs(j-0)) print("\t",temp)
17th NTRCA job circular 2020 published today on their website. NTRCA is established in 2005 under the Ministry of Education. NTRCA is working for properly trained and skilled teachers. The first stage of 17th NTRCA job circular 2020 recruitment start with preliminary test. After passing NTRCA preliminary test, you have to attend for written test. The final test is viva after successfully pass all the test. You can get NTRCA job circular, syllabus, online application and download admit card in Recent Job Circular
ReplyDelete