Application of Artificial intelligence (A*) - Puzzle - 8
This Programme is to apply A* algorithm to the puzzle-8.
Puzzle-8:
This is a simple sliding game which children use to solve. The same sliding game becomes a great challange to solve by using computer. The traditional meathod of solving by using various combination is very long process. AI's algorithm A* (A-Star) allow us to slove the same with less iterations.
How to open:
1. Extract files from "8puzzle.zip" and save all files in one folder.
2. Run the file "gskmadem8puzzle.m" from MATLAB.
3. Change the MATLAB location to the present folder location.
4. Give input of 3 X 3 matrix (use 0 instead of space)
5. Wait for few minutes. The solution will be displayed as the algorithm reaches its goal.(Waiting time depends on computer speed also on the input convergence). Approximate time needed is 30 seconds to 10 minutes.
Supporting files:
1. gskcostastar.m
2. gskmadem8puzzle.m
3. gskpzget.m
4. gskpzjoin.m
5. gsksearch.m
Sample Input and Output:
Upon executing "gskmadem8puzzle.m", Following screen is expected (input considered is "[4 5 6; 1 7 0; 8 3 2]")
enter a puzzle in 3 x 3 form (use 0 for space) ..........: [4 5 6; 1 7 0; 8 3 2]
intv000 =
1
pzout =
4 5 6
1 7 0
8 3 2
intv000 =
2
pzout =
4 5 0
1 7 6
8 3 2
intv000 =
3
pzout =
4 0 5
1 7 6
8 3 2
intv000 =
4
pzout =
0 4 5
1 7 6
8 3 2
intv000 =
5
pzout =
1 4 5
0 7 6
8 3 2
intv000 =
6
pzout =
1 4 5
7 0 6
8 3 2
intv000 =
7
pzout =
1 4 5
7 6 0
8 3 2
intv000 =
8
pzout =
1 4 5
7 6 2
8 3 0
intv000 =
9
pzout =
1 4 5
7 6 2
8 0 3
intv000 =
10
pzout =
1 4 5
7 0 2
8 6 3
intv000 =
11
pzout =
1 0 5
7 4 2
8 6 3
intv000 =
12
pzout =
1 5 0
7 4 2
8 6 3
intv000 =
13
pzout =
1 5 2
7 4 0
8 6 3
intv000 =
14
pzout =
1 5 2
7 4 3
8 6 0
intv000 =
15
pzout =
1 5 2
7 4 3
8 0 6
intv000 =
16
pzout =
1 5 2
7 4 3
0 8 6
intv000 =
17
pzout =
1 5 2
0 4 3
7 8 6
intv000 =
18
pzout =
1 5 2
4 0 3
7 8 6
intv000 =
19
pzout =
1 0 2
4 5 3
7 8 6
intv000 =
20
pzout =
1 2 0
4 5 3
7 8 6
intv000 =
21
pzout =
1 2 3
4 5 0
7 8 6
intv000 =
22
pzout =
1 2 3
4 5 6
7 8 0
******************************
Feel free to inform about corrections and suggestions.
Cite As
Suresh Kumar Gadi (2024). Application of Artificial intelligence (A*) - Puzzle - 8 (https://www.mathworks.com/matlabcentral/fileexchange/21154-application-of-artificial-intelligence-a-puzzle-8), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired: Application of Artificial Intelligence (ID A*) - 8-Puzzle
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
8puzzle/
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |