Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. bfs(state, timeLimit){
  2. q = [state]; visited=[];
  3. while(q.length){
  4. node = dequeue;
  5. visited.push(node)
  6. get actions from clonedState
  7. for each action:
  8. clone node -> clonedState
  9. update clonedState with eachAction
  10. if visited has updated clonedState, then continue; // already visited
  11. visited.push(updated cloned state);
  12. q.enqueue (updated cloned state);
  13. find score and keep track of bestState with maxScore
  14. }
  15. return bestState;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement