0 votes
1 view
in AI and Deep Learning by (43.2k points)

I am looking for a code in java that implements DFS and BFS for the 8-puzzle game by given initial state :

1 2 3 

8 0 4 

7 6 5

and Goal state

2 8 1 

0 4 3 

7 6 5

I need to print the solution path from initial to the goal state (Not done yet)

This is the code I have. So far I have only been able to implement DFS. What my program does so far is it outputs SUCCESS once it finds the goal state. However, it never gets to this point.

Can someone tell me where I am going wrong?

1 Answer

0 votes
by (92.8k points)

Given a 3×3 board with 8 tiles (every tile has one number from 1 to 8) and one empty space. The objective is to place the numbers on tiles to match the final configuration using the empty space. We can slide four adjacent (left, right, above and below) tiles into the empty space. you can refer the following link for the full implementation of 8 puzzle problem in java language : https://github.com/gferrer/8-Puzzle-Solver/blob/master/DFSearch.java

If you are looking to learn more about Artificial Intelligence then visit this Artificial Intelligence Course which will cover topics like Simulated annealing algorithm Euclidean distance, Pearson correlation coefficient, Brute force search algorithms, Backtracking, Traveling salesman problem, NeuroEvolution of augmenting topologies, Fitness function, Resolution algorithm,k-nearest neighbors algorithm, Markov model, Genetic algorithm, deep first iterative deeping and many more.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...