Link to home
Start Free TrialLog in
Avatar of LOGANSAN
LOGANSAN

asked on

Search algorithm

1st part.How to implement A* search algorithm in C++ 2nd part how to use this implementation to solve the 8-puzzle problem.
Avatar of LOGANSAN
LOGANSAN

ASKER

The starting state is started by reading in 9 integers in which the first three represent the top row of tiles the second three represent the middle row of tiles and the last three represent the last row.  The blank tile is lablled 0.  The others are labelled 1-8.  Ex. 2 6 0 4 8 3 1 5 7.  Please document so I can understand what was done.
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Roger, I agree about the homework part by why would you lock the question thus preventing LOGANSAN from realizing the error of his ways and deleting the question?  Was there some ulterior motive involved?
nope - no ulterior motive.

If it IS homework, then it'll cost him points to get rid of it (which might discourage him from getting us to do his assignments for him).  And it might also encourage him to do some work first and put up a starting point for his code so we can then help him further.

If it IS NOT homework, then he can reject the answer and we can continue to help with a genuine problem.

I usually post "we won't do your homework for you" messages as answers for that reason.


I need to see an implementation of the A-star algorithm in C++.
I can't find in books in my area with a example of the A_star algorithm just the theory behind it.  I need this in order to write a program to modify the A-star algorithm and then use it.  However, I am having trouble getting started.
Comment on A-star algorithm:
1 set L ot be a list containing the initial node of the problem
2 let n be node on L for which f(n)=g(n)+h'(n) is minimal. If L is empty fail
3 if n is a goal node, stop and return it and the path from the initial node to n
4 otherwise remove n from L and add to L all of n's children labeling each child with its path from the initial node return to step 2
I can give you some pointers to get you started:
  http://www-cs-students.stanford.edu/~amitp/Articles/AStar1.html
  http://home.das-netz.de/pat/a-star.htm

(I suggest you reopen the question)