views:

41

answers:

1

I have to find the set of action of my agent in wumpus. In this case my agent can turn left, turn right and go forward. Now I have one method that can find the adjustcent of my agent. I also have another method that can find the direction of my agent(North,East,West,South)

Assuming agent stand at 2,2 position and the current direction is north and I want to go to 2,3 the step are turn right follow by forward. How can i generate this in JAVA.

Another example is agent stand at 3,3 and current direction is south and I want to go to 2,3 the step are turn right or turn left 2 times follow by forward.

Ps 1. The left up conner is 0,0 and the right down conner is 3,3

A: 

pseudocode:

1. set wumpus to face north.
2. if target column > starting column, turn right, move forward (target column - starting column) steps
   else if target column < starting column, turn left, move forward (starting column - target column) steps
3. set wumpus to face north.
4. if target row > starting row, turn right twice, move forward (target row - starting row) steps
   else if target row < starting row, move forward (starting row - target row) steps.
euphoria83