You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
2.1 KiB

1 year ago
  1. smg
  2. player Agent
  3. [Agent_move_north], [Agent_move_east], [Agent_move_south], [Agent_move_west], [Agent_turn_left], [Agent_turn_right]
  4. endplayer
  5. global move : [0..0] init 0;
  6. formula AgentCannotMoveNorth = (xAgent=1&yAgent=1) | (xAgent=1&yAgent=2) | (xAgent=1&yAgent=3) | (xAgent=1&yAgent=4) | (xAgent=1&yAgent=5) | (xAgent=1&yAgent=6) | (xAgent=1&yAgent=7);
  7. formula AgentCannotMoveEast = (xAgent=1&yAgent=7) | (xAgent=2&yAgent=1) | (xAgent=2&yAgent=7) | (xAgent=3&yAgent=1) | (xAgent=3&yAgent=7) | (xAgent=4&yAgent=1) | (xAgent=4&yAgent=7) | (xAgent=5&yAgent=1) | (xAgent=5&yAgent=7) | (xAgent=6&yAgent=1) | (xAgent=6&yAgent=7) | (xAgent=7&yAgent=7) | (xAgent=7&yAgent=1);
  8. formula AgentCannotMoveSouth = (xAgent=1&yAgent=2) | (xAgent=7&yAgent=3) | (xAgent=7&yAgent=4) | (xAgent=7&yAgent=5) | (xAgent=7&yAgent=6) | (xAgent=7&yAgent=7) | (xAgent=7&yAgent=1);
  9. formula AgentCannotMoveWest = (xAgent=1&yAgent=1) | (xAgent=2&yAgent=1) | (xAgent=2&yAgent=3) | (xAgent=3&yAgent=1) | (xAgent=3&yAgent=3) | (xAgent=4&yAgent=1) | (xAgent=4&yAgent=3) | (xAgent=5&yAgent=1) | (xAgent=5&yAgent=3) | (xAgent=6&yAgent=1) | (xAgent=6&yAgent=3) | (xAgent=7&yAgent=3) | (xAgent=7&yAgent=1);
  10. formula AgentIsOnSlippery = false;
  11. label AgentGoal = (xAgent=7&yAgent=7);
  12. label crash = ;
  13. module Agent
  14. xAgent : [1..8] init 7;
  15. yAgent : [1..8] init 1;
  16. viewAgent : [0..3] init 1;
  17. [Agent_turn_right] move=0 & true -> (viewAgent'=mod(viewAgent + 1, 4)) & (move'=0) ;
  18. [Agent_turn_left] move=0 & viewAgent>0 -> (viewAgent'=viewAgent - 1) & (move'=0) ;
  19. [Agent_turn_left] move=0 & viewAgent=0 -> (viewAgent'=3) & (move'=0) ;
  20. [Agent_move_north] move=0 & viewAgent=3 & !AgentIsOnSlippery & !AgentCannotMoveNorth -> (xAgent'=xAgent-1) & (move'=0) ;
  21. [Agent_move_east] move=0 & viewAgent=0 & !AgentIsOnSlippery & !AgentCannotMoveEast -> (yAgent'=yAgent+1) & (move'=0) ;
  22. [Agent_move_south] move=0 & viewAgent=1 & !AgentIsOnSlippery & !AgentCannotMoveSouth -> (xAgent'=xAgent+1) & (move'=0) ;
  23. [Agent_move_west] move=0 & viewAgent=2 & !AgentIsOnSlippery & !AgentCannotMoveWest -> (yAgent'=yAgent-1) & (move'=0) ;
  24. endmodule