|
|
| File Information |
| Description |
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. |
| MATLAB release |
MATLAB 7.1.0 (R14SP3)
|
| Zip File Content |
|
| Other Files |
8puzzle/gskcostastar.m, 8puzzle/gskmadem8puzzle.m, 8puzzle/gskpzget.m, 8puzzle/gskpzjoin.m, 8puzzle/gsksearch.m
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (1) |
| 21 Aug 2008 |
Jess Zhou
|
|
|
|
MATLAB Central Terms of Use
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.
Contact us at files@mathworks.com