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.

65 lines
7.7 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. player Blue
  6. [Blue_move_north], [Blue_move_east], [Blue_move_south], [Blue_move_west], [Blue_turns]
  7. endplayer
  8. global move : [0..1] init 0;
  9. label AgentOnBlue = (xAgent=1&yAgent=1) | (xAgent=1&yAgent=2) | (xAgent=1&yAgent=3) | (xAgent=1&yAgent=6) | (xAgent=1&yAgent=7) | (xAgent=1&yAgent=8) | (xAgent=1&yAgent=9) | (xAgent=1&yAgent=10) | (xAgent=1&yAgent=11) | (xAgent=2&yAgent=1) | (xAgent=2&yAgent=11) | (xAgent=3&yAgent=1) | (xAgent=3&yAgent=2) | (xAgent=3&yAgent=3) | (xAgent=3&yAgent=4) | (xAgent=3&yAgent=5) | (xAgent=3&yAgent=6) | (xAgent=3&yAgent=7) | (xAgent=3&yAgent=8) | (xAgent=3&yAgent=9) | (xAgent=3&yAgent=10) | (xAgent=3&yAgent=11);
  10. label BlueOnBlue = (xBlue=1&yBlue=1) | (xBlue=1&yBlue=2) | (xBlue=1&yBlue=3) | (xBlue=1&yBlue=6) | (xBlue=1&yBlue=7) | (xBlue=1&yBlue=8) | (xBlue=1&yBlue=9) | (xBlue=1&yBlue=10) | (xBlue=1&yBlue=11) | (xBlue=2&yBlue=1) | (xBlue=2&yBlue=11) | (xBlue=3&yBlue=1) | (xBlue=3&yBlue=2) | (xBlue=3&yBlue=3) | (xBlue=3&yBlue=4) | (xBlue=3&yBlue=5) | (xBlue=3&yBlue=6) | (xBlue=3&yBlue=7) | (xBlue=3&yBlue=8) | (xBlue=3&yBlue=9) | (xBlue=3&yBlue=10) | (xBlue=3&yBlue=11);
  11. label AgentOnGreen = (xAgent=9&yAgent=1) | (xAgent=9&yAgent=2) | (xAgent=9&yAgent=3) | (xAgent=9&yAgent=4) | (xAgent=9&yAgent=5) | (xAgent=9&yAgent=6) | (xAgent=9&yAgent=7) | (xAgent=9&yAgent=8) | (xAgent=9&yAgent=9) | (xAgent=9&yAgent=10) | (xAgent=9&yAgent=11) | (xAgent=10&yAgent=1) | (xAgent=10&yAgent=11) | (xAgent=11&yAgent=1) | (xAgent=11&yAgent=2) | (xAgent=11&yAgent=3) | (xAgent=11&yAgent=4) | (xAgent=11&yAgent=5) | (xAgent=11&yAgent=6) | (xAgent=11&yAgent=7) | (xAgent=11&yAgent=8) | (xAgent=11&yAgent=9) | (xAgent=11&yAgent=10) | (xAgent=11&yAgent=11);
  12. label BlueOnGreen = (xBlue=9&yBlue=1) | (xBlue=9&yBlue=2) | (xBlue=9&yBlue=3) | (xBlue=9&yBlue=4) | (xBlue=9&yBlue=5) | (xBlue=9&yBlue=6) | (xBlue=9&yBlue=7) | (xBlue=9&yBlue=8) | (xBlue=9&yBlue=9) | (xBlue=9&yBlue=10) | (xBlue=9&yBlue=11) | (xBlue=10&yBlue=1) | (xBlue=10&yBlue=11) | (xBlue=11&yBlue=1) | (xBlue=11&yBlue=2) | (xBlue=11&yBlue=3) | (xBlue=11&yBlue=4) | (xBlue=11&yBlue=5) | (xBlue=11&yBlue=6) | (xBlue=11&yBlue=7) | (xBlue=11&yBlue=8) | (xBlue=11&yBlue=9) | (xBlue=11&yBlue=10) | (xBlue=11&yBlue=11);
  13. label AgentOnRed = (xAgent=1&yAgent=4) | (xAgent=1&yAgent=5);
  14. label BlueOnRed = (xBlue=1&yBlue=4) | (xBlue=1&yBlue=5);
  15. formula AgentCannotMoveNorth = (xAgent=1&yAgent=2) | (xAgent=1&yAgent=3) | (xAgent=1&yAgent=4) | (xAgent=1&yAgent=5) | (xAgent=1&yAgent=6) | (xAgent=1&yAgent=7) | (xAgent=1&yAgent=8) | (xAgent=1&yAgent=9) | (xAgent=1&yAgent=10) | (xAgent=1&yAgent=11) | (xAgent=3&yAgent=2) | (xAgent=3&yAgent=3) | (xAgent=3&yAgent=4) | (xAgent=3&yAgent=5) | (xAgent=3&yAgent=6) | (xAgent=3&yAgent=7) | (xAgent=3&yAgent=8) | (xAgent=3&yAgent=9) | (xAgent=3&yAgent=10) | (xAgent=11&yAgent=2) | (xAgent=11&yAgent=3) | (xAgent=11&yAgent=4) | (xAgent=11&yAgent=5) | (xAgent=11&yAgent=6) | (xAgent=11&yAgent=7) | (xAgent=11&yAgent=8) | (xAgent=11&yAgent=9) | (xAgent=11&yAgent=10) | (xAgent=1&yAgent=1);
  16. formula AgentCannotMoveEast = (xAgent=1&yAgent=11) | (xAgent=2&yAgent=1) | (xAgent=2&yAgent=11) | (xAgent=3&yAgent=11) | (xAgent=4&yAgent=11) | (xAgent=5&yAgent=11) | (xAgent=6&yAgent=11) | (xAgent=8&yAgent=11) | (xAgent=9&yAgent=11) | (xAgent=10&yAgent=1) | (xAgent=10&yAgent=11) | (xAgent=11&yAgent=11) | (xAgent=7&yAgent=11);
  17. formula AgentCannotMoveSouth = (xAgent=1&yAgent=2) | (xAgent=1&yAgent=3) | (xAgent=1&yAgent=4) | (xAgent=1&yAgent=5) | (xAgent=1&yAgent=6) | (xAgent=1&yAgent=7) | (xAgent=1&yAgent=8) | (xAgent=1&yAgent=9) | (xAgent=1&yAgent=10) | (xAgent=9&yAgent=2) | (xAgent=9&yAgent=3) | (xAgent=9&yAgent=4) | (xAgent=9&yAgent=5) | (xAgent=9&yAgent=6) | (xAgent=9&yAgent=7) | (xAgent=9&yAgent=8) | (xAgent=9&yAgent=9) | (xAgent=9&yAgent=10) | (xAgent=11&yAgent=1) | (xAgent=11&yAgent=2) | (xAgent=11&yAgent=3) | (xAgent=11&yAgent=4) | (xAgent=11&yAgent=5) | (xAgent=11&yAgent=6) | (xAgent=11&yAgent=7) | (xAgent=11&yAgent=8) | (xAgent=11&yAgent=9) | (xAgent=11&yAgent=10) | (xAgent=11&yAgent=11);
  18. formula AgentCannotMoveWest = (xAgent=2&yAgent=1) | (xAgent=2&yAgent=11) | (xAgent=3&yAgent=1) | (xAgent=5&yAgent=1) | (xAgent=6&yAgent=1) | (xAgent=7&yAgent=1) | (xAgent=8&yAgent=1) | (xAgent=9&yAgent=1) | (xAgent=10&yAgent=1) | (xAgent=10&yAgent=11) | (xAgent=11&yAgent=1) | (xAgent=1&yAgent=1) | (xAgent=4&yAgent=1);
  19. formula AgentIsOnSlippery = false;
  20. label AgentGoal = false;
  21. formula BlueCannotMoveNorth = (xBlue=1&yBlue=2) | (xBlue=1&yBlue=3) | (xBlue=1&yBlue=4) | (xBlue=1&yBlue=5) | (xBlue=1&yBlue=6) | (xBlue=1&yBlue=7) | (xBlue=1&yBlue=8) | (xBlue=1&yBlue=9) | (xBlue=1&yBlue=10) | (xBlue=1&yBlue=11) | (xBlue=3&yBlue=2) | (xBlue=3&yBlue=3) | (xBlue=3&yBlue=4) | (xBlue=3&yBlue=5) | (xBlue=3&yBlue=6) | (xBlue=3&yBlue=7) | (xBlue=3&yBlue=8) | (xBlue=3&yBlue=9) | (xBlue=3&yBlue=10) | (xBlue=11&yBlue=2) | (xBlue=11&yBlue=3) | (xBlue=11&yBlue=4) | (xBlue=11&yBlue=5) | (xBlue=11&yBlue=6) | (xBlue=11&yBlue=7) | (xBlue=11&yBlue=8) | (xBlue=11&yBlue=9) | (xBlue=11&yBlue=10) | (xBlue=1&yBlue=1);
  22. formula BlueCannotMoveEast = (xBlue=1&yBlue=11) | (xBlue=2&yBlue=1) | (xBlue=2&yBlue=11) | (xBlue=3&yBlue=11) | (xBlue=4&yBlue=11) | (xBlue=5&yBlue=11) | (xBlue=6&yBlue=11) | (xBlue=8&yBlue=11) | (xBlue=9&yBlue=11) | (xBlue=10&yBlue=1) | (xBlue=10&yBlue=11) | (xBlue=11&yBlue=11) | (xBlue=7&yBlue=11);
  23. formula BlueCannotMoveSouth = (xBlue=1&yBlue=2) | (xBlue=1&yBlue=3) | (xBlue=1&yBlue=4) | (xBlue=1&yBlue=5) | (xBlue=1&yBlue=6) | (xBlue=1&yBlue=7) | (xBlue=1&yBlue=8) | (xBlue=1&yBlue=9) | (xBlue=1&yBlue=10) | (xBlue=9&yBlue=2) | (xBlue=9&yBlue=3) | (xBlue=9&yBlue=4) | (xBlue=9&yBlue=5) | (xBlue=9&yBlue=6) | (xBlue=9&yBlue=7) | (xBlue=9&yBlue=8) | (xBlue=9&yBlue=9) | (xBlue=9&yBlue=10) | (xBlue=11&yBlue=1) | (xBlue=11&yBlue=2) | (xBlue=11&yBlue=3) | (xBlue=11&yBlue=4) | (xBlue=11&yBlue=5) | (xBlue=11&yBlue=6) | (xBlue=11&yBlue=7) | (xBlue=11&yBlue=8) | (xBlue=11&yBlue=9) | (xBlue=11&yBlue=10) | (xBlue=11&yBlue=11);
  24. formula BlueCannotMoveWest = (xBlue=2&yBlue=1) | (xBlue=2&yBlue=11) | (xBlue=3&yBlue=1) | (xBlue=5&yBlue=1) | (xBlue=6&yBlue=1) | (xBlue=7&yBlue=1) | (xBlue=8&yBlue=1) | (xBlue=9&yBlue=1) | (xBlue=10&yBlue=1) | (xBlue=10&yBlue=11) | (xBlue=11&yBlue=1) | (xBlue=1&yBlue=1) | (xBlue=4&yBlue=1);
  25. formula BlueIsOnSlippery = false;
  26. label BlueGoal = false;
  27. label crash = (xAgent=xBlue)&(yAgent=yBlue);
  28. module Agent
  29. xAgent : [1..12] init 1;
  30. yAgent : [1..12] init 1;
  31. viewAgent : [0..3] init 1;
  32. [Agent_turn_right] move=0 & true -> (viewAgent'=mod(viewAgent + 1, 4)) & (move'=1) ;
  33. [Agent_turn_left] move=0 & viewAgent>0 -> (viewAgent'=viewAgent - 1) & (move'=1) ;
  34. [Agent_turn_left] move=0 & viewAgent=0 -> (viewAgent'=3) & (move'=1) ;
  35. [Agent_move_north] move=0 & viewAgent=3 & !AgentIsOnSlippery & !AgentCannotMoveNorth -> (xAgent'=xAgent-1) & (move'=1) ;
  36. [Agent_move_east] move=0 & viewAgent=0 & !AgentIsOnSlippery & !AgentCannotMoveEast -> (yAgent'=yAgent+1) & (move'=1) ;
  37. [Agent_move_south] move=0 & viewAgent=1 & !AgentIsOnSlippery & !AgentCannotMoveSouth -> (xAgent'=xAgent+1) & (move'=1) ;
  38. [Agent_move_west] move=0 & viewAgent=2 & !AgentIsOnSlippery & !AgentCannotMoveWest -> (yAgent'=yAgent-1) & (move'=1) ;
  39. endmodule
  40. module Blue
  41. xBlue : [1..12] init 7;
  42. yBlue : [1..12] init 11;
  43. [Blue_turns] move=1 & true -> (xBlue'=xBlue) & (move'=0) ;
  44. [Blue_move_north] move=1 & !BlueIsOnSlippery & !BlueCannotMoveNorth -> (xBlue'=xBlue-1) & (move'=0) ;
  45. [Blue_move_east] move=1 & !BlueIsOnSlippery & !BlueCannotMoveEast -> (yBlue'=yBlue+1) & (move'=0) ;
  46. [Blue_move_south] move=1 & !BlueIsOnSlippery & !BlueCannotMoveSouth -> (xBlue'=xBlue+1) & (move'=0) ;
  47. [Blue_move_west] move=1 & !BlueIsOnSlippery & !BlueCannotMoveWest -> (yBlue'=yBlue-1) & (move'=0) ;
  48. endmodule