Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. private Action decide(Perception perception) {
  2. // todo modify to improve the ReactiveAgent's decision process
  3.  
  4. if (perception.getN() != null && !perception.getN().hasWall() && !perception.getN().hasAgent()){
  5. return Action.NORTH;
  6. }
  7.  
  8. if (perception.getW() != null && !perception.getW().hasWall() && !perception.getW().hasAgent()){
  9. return Action.WEST;
  10. }
  11.  
  12. if (perception.getS() != null && !perception.getS().hasWall() && !perception.getS().hasAgent()){
  13. return Action.SOUTH;
  14. }
  15.  
  16. if (perception.getE() != null && !perception.getE().hasWall() && !perception.getE().hasAgent()){
  17. return Action.EAST;
  18. }
  19.  
  20. return Action.WEST; // life is peaceful there :-)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement