color(position)foreach successor adjacent to node"position"ifsuccessoriscolored, skip itifnextisthe goal node, stop the searchelse, dfs(successor) end end //Simple bfsstructure node position pos node*parent end function bfs(node start_position) add start_position to the queuewhilethe queueisnot...
put the starting node on the open list (you can leave its f at zero)whilethe open listisnot empty find the node with the least f on the open list, call it"q"pop q off the open list generate q's 8 successors and set their parents to qforeach successorifsuccessoristhe goal, stop ...