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.

113 lines
5.4 KiB

  1. mdp
  2. const int initY = 40;
  3. const int initX = 80;
  4. const int maxY = 580;
  5. const int minX = 10;
  6. const int maxX = 144;
  7. formula Gate_1 = (((42<x & x<50) | (74<x & x<82)) & 164<y & y<172);
  8. formula Gate_2 = (((72<x & x<80) | (104<x & x<112)) & 256<y & y<264);
  9. formula Gate_3 = (((80<x & x<88) | (112<x & x<120)) & 349<y & y<357);
  10. formula Gate_4 = (((54<x & x<62) | (88<x & x<96)) & 442<y & y<450);
  11. formula Gate_5 = (((80<x & x<88) | (112<x & x<120)) & 530<y & y<538);
  12. formula Passed_Gate_1 = ((x>46 & x<78) & (y>160 & y<176)); //(y=168));
  13. formula Passed_Gate_2 = ((x>76 & x<108) & (y>253 & y<269)); //(y=261));
  14. formula Passed_Gate_3 = ((x>84 & x<116) & (y>345 & y<361)); //(y=353));
  15. formula Passed_Gate_4 = ((x>58 & x<92) & (y>438 & y<454)); //(y=446));
  16. formula Passed_Gate_5 = ((x>84 & x<116) & (y>530 & y<546)); //(y=538));
  17. formula Left_Gate_1 = y>176;
  18. formula Left_Gate_2 = y>269;
  19. formula Left_Gate_3 = y>361;
  20. formula Left_Gate_4 = y>454;
  21. formula Left_Gate_5 = y>546;
  22. formula Tree_1 = ((x>=124 & x<=142) & (y>=190 & y<=200));
  23. formula Tree_2 = ((x>=32 & x<=49) & (y>=284 & y<=295));
  24. formula Tree_3 = ((x>=30 & x<=49) & (y>=317 & y<=327));
  25. formula Tree_4 = ((x>=12 & x<=30) & (y>=408 & y<=418));
  26. formula Tree_5 = ((x>=129 & x<=146) & (y>=468 & y<=480));
  27. formula Tree_6 = ((x>=140 & x<=152) & (y>=496 & y<=510));
  28. formula Hit_Tree = Tree_1 | Tree_2 | Tree_3 | Tree_4 | Tree_5 | Tree_6;
  29. formula Hit_Gate = Gate_1 | Gate_2 | Gate_3 | Gate_4 | Gate_5;
  30. formula Passed_Gate = Passed_Gate_1 | Passed_Gate_2 | Passed_Gate_3 | Passed_Gate_4 | Passed_Gate_5;
  31. formula Left_Gate = Left_Gate_1 | Left_Gate_2 | Left_Gate_3 | Left_Gate_4 | Left_Gate_5;
  32. global move : [0..3];
  33. formula Fixed_Left = false;
  34. formula Fixed_Right = false;
  35. formula Fixed_Noop = false;
  36. formula Fixed = Fixed_Left | Fixed_Right | Fixed_Noop;
  37. module skier
  38. ski_position : [1..8] ;
  39. done : bool ;
  40. passed_gate : bool ;
  41. [left] !Fixed & !passed_gate & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Passed_Gate));
  42. [right] !Fixed & !passed_gate & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Passed_Gate));
  43. [noop] !Fixed & !passed_gate & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Passed_Gate));
  44. [left] !Fixed & passed_gate & move=0 & ski_position>1 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  45. [right] !Fixed & passed_gate & move=0 & ski_position<8 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  46. [noop] !Fixed & passed_gate & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  47. [left] Fixed_Left & move=0 -> (ski_position'=ski_position-1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  48. [right] Fixed_Right & move=0 -> (ski_position'=ski_position+1) & (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  49. [noop] Fixed_Noop & move=0 -> (move'=1) & (done'=(Hit_Tree|Hit_Gate))& (passed_gate'=(Left_Gate));
  50. [done] done -> true;
  51. endmodule
  52. module updateY
  53. y : [initY..maxY] ;
  54. velocity: [0..16];
  55. standstill : [0..8] ;
  56. [update_y] move=1 & standstill>=5 -> (y'=y) & (move'=2);
  57. [update_y] move=1 & standstill<5 -> (y'=min(maxY,y+velocity)) & (move'=2);
  58. [update_y] move=2 & (ski_position=1 | ski_position = 8) & standstill>=5 -> (standstill'=min(8,standstill+1)) & (move'=3);
  59. [update_y] move=2 & (ski_position=1 | ski_position = 8) & standstill<5 -> (velocity'=max(0,velocity-4)) &(move'=3);
  60. [update_y] move=2 & (ski_position=2 | ski_position = 7) -> (velocity'=max(0 ,velocity-2)) & (standstill'=0) & (move'=3);
  61. [update_y] move=2 & (ski_position=3 | ski_position = 6) -> (velocity'=min(8,velocity+2)) & (standstill'=0) & (move'=3);
  62. [update_y] move=2 & (ski_position=4 | ski_position = 5) -> (velocity'=min(8,velocity+4)) & (standstill'=0) & (move'=3);
  63. endmodule
  64. module updateX
  65. x : [minX..maxX] ;
  66. [update_x] move=3 & standstill>=8 -> (move'=0);
  67. [update_x] move=3 & standstill<8 & (ski_position=4 | ski_position=5) -> (move'=0);
  68. [update_x] move=3 & standstill<8 & (ski_position=3) -> 0.4: (x'=max(minX,x-0)) & (move'=0) + 0.6: (x'=max(minX,x-1)) & (move'=0);
  69. [update_x] move=3 & standstill<8 & (ski_position=6) -> 0.4: (x'=min(maxX,x+0)) & (move'=0) + 0.6: (x'=min(maxX,x+1)) & (move'=0);
  70. [update_x] move=3 & standstill<8 & (ski_position=2) -> 0.3: (x'=max(minX,x-0)) & (move'=0) + 0.7: (x'=max(minX,x-1)) & (move'=0);
  71. [update_x] move=3 & standstill<8 & (ski_position=7) -> 0.3: (x'=min(maxX,x+0)) & (move'=0) + 0.7: (x'=min(maxX,x+1)) & (move'=0);
  72. [update_x] move=3 & standstill<8 & (ski_position=1) -> 0.2: (x'=max(minX,x-0)) & (move'=0) + 0.8: (x'=max(minX,x-1)) & (move'=0);
  73. [update_x] move=3 & standstill<8 & (ski_position=8) -> 0.2: (x'=min(maxX,x+0)) & (move'=0) + 0.8: (x'=min(maxX,x+1)) & (move'=0);
  74. endmodule
  75. rewards
  76. //[left] !passed_gate & standstill<2 & Passed_Gate: 100;
  77. //[right] !passed_gate & standstill<2 & Passed_Gate: 100;
  78. //[noop] !passed_gate & standstill<2 & Passed_Gate: 100;
  79. [left] !done & (Hit_Tree) : -100;
  80. [right] !done & (Hit_Tree) : -100;
  81. [noop] !done & (Hit_Tree) : -100;
  82. [left] !done & (Hit_Gate) : -100;
  83. [right] !done & (Hit_Gate) : -100;
  84. [noop] !done & (Hit_Gate) : -100;
  85. endrewards