Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bfs(state, timeLimit){
- q = [state]; visited=[];
- while(q.length){
- node = dequeue;
- visited.push(node)
- get actions from clonedState
- for each action:
- clone node -> clonedState
- update clonedState with eachAction
- if visited has updated clonedState, then continue; // already visited
- visited.push(updated cloned state);
- q.enqueue (updated cloned state);
- find score and keep track of bestState with maxScore
- }
- return bestState;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement