Skip to content

basicsharp/EightPuzzle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

If you want to implement with GUI, please download the latest Eclipse for Java Developer release (Indigo) from http://www.eclipse.org/. See this wiki page for more information about setup Eclipse for using XWT GUI Framework.

Anyway, you can implement without install new Eclipse for just GUI (use System.out.print to test or other ways, up to you) and send code back to me for merging, since I separated works into definite methods.

There are some unimplemented methods left as listed below:

AStarSearching.solvePuzzle()

I prepared 2 TreeMap TreeSet named "nodes" and "expandedNodes" for node pruning following the A* search algorithm. hCalculator will calculate heuristic score (the lower is the better).

and 3 more methods…

ManhattanDistanceHeuristicCalculator.calculate(PuzzleState targetState, PuzzleState baseState)

EuclideanDistanceHeuristicCalculator.calculate(PuzzleState targetState, PuzzleState baseState)

MisplacedTilesHeuristicCalculator.calculate(PuzzleState targetState, PuzzleState baseState)

PuzzleState Class

PuzzleState instance is basically a node in our puzzle tree. It stores an array of puzzle tiles and its heuristic score. It can expand itself (generates more states by tile movings) and check whether it is a final state or not.

Constants

Constants for this project are defined in C.java

Questions?

If you have questions or found problems, post it on our Facebook group's wall.

http://www.facebook.com/home.php?sk=group_157364804332499&ap=1

About

Eight Puzzle solving using Java for studying in Knowledge Base System subject.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages