Output what entity?
Main Topics
Browse All TopicsHello everyone.
I have an example of a Pacman game, we are doing path finding and we are looking at BFS (Breadth first search)
I need to be able to write down all the paths that the BFS search explores when searching for a path to the "goal". It suggests that It would be quicker to edit the pathPlanBFS function so that the program writes out the paths for you.
There are many loops within loops and I am not sure what entity I should be printing off or where to put the cout.
And can someone explain this line to me as well
if(adjacencyMatrix[current
What is the if statement actually asking, if either is true or false?
- Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
BFS is used in AI in computer games.
let's say I'm in a room and the computer player is in another room, the program checks for all the possible routes until it can reach the room I am currently in.
Its a tree that starts at 1 and from 1 it splits into a number of different branches, the program goes left hand side first and checks all the rooms until it reaches the leaf goal.
arcyani:
pretty intuitive and straightforward for an AI algo.
just look at the below two lines. Your requirement is to print all the possible explored paths. So ppathTmp stores the possible indexes added to the current path. So print this list out everytime. You will see each index which gets added to the path list.
Next there could be several other paths, this is why you have a pathTree. Print this list out too.
Business Accounts
Answer for Membership
by: Let_Me_BePosted on 2009-11-02 at 02:27:48ID: 25718262
What do you mean all paths? All paths that lead to goal? Then simply instead of setting goalFound=true, output the path.
adjacencyMatrix is obviously an adjacency matrix marking what nodes are adjacent (you can move from one to another).