1234567891011121314 |
- #!/usr/bin/env python3
- from environment import State, goalTest, actions, result
- from collections import deque
- # Example of goal-oriented agent.
- frontier = deque() # Initialize the frontier as a queue
- state = State() # Generate the initial state
- while not goalTest(state): # Apply the global test
- for action in actions(state): # Expand the node
- frontier.append(result(state, action))
- state = frontier.popleft()
- state.printState()
|