const double attack = 0.2;
const double recover = 0.8;
const double fail = 0.2;
const double repair = 0.8;
csg
player policy policy endplayer
player attacker attacker endplayer
const int rounds;
module rounds
r : [0..rounds];
[] r<rounds -> (r'=r+1);
[] r=rounds -> true;
endmodule
module csystem
s : [1..3];
[defend1,attack1] s=1 -> (s'=1);
[defend1,attack2] s=1 -> 1-attack : (s'=1) + attack : (s'=2);
[defend2,attack1] s=1 -> 1-attack : (s'=1) + attack : (s'=2);
[defend2,attack2] s=1 -> (s'=1);
[defend1,attack1] s=2 -> recover : (s'=1) + 1-recover : (s'=2);
[defend1,attack2] s=2 -> 1-fail : (s'=2) + fail : (s'=3);
[defend2,attack1] s=2 -> 1-fail : (s'=2) + fail : (s'=3);
[defend2,attack2] s=2 -> recover : (s'=1) + 1-recover : (s'=2);
[defend1,attack1] s=3 -> repair : (s'=2) + 1-repair : (s'=3);
[defend1,attack2] s=3 -> (s'=3);
[defend2,attack1] s=3 -> (s'=3);
[defend2,attack2] s=3 -> repair : (s'=2) + 1-repair : (s'=3);
endmodule
module policy
[defend1] r<rounds -> true;
[defend2] r<rounds -> true;
endmodule
module attacker
[attack1] r<rounds -> true;
[attack2] r<rounds -> true;
endmodule
rewards "damage"
[defend1,attack1] s=1 : 0;
[defend1,attack2] s=1 : 1;
[defend2,attack1] s=1 : 0.5;
[defend2,attack2] s=1 : 0;
[defend1,attack1] s=2 : 1;
[defend1,attack2] s=2 : 2;
[defend2,attack1] s=2 : 1.5;
[defend2,attack2] s=2 : 1;
[defend1,attack1] s=3 : 1;
[defend1,attack2] s=3 : 3;
[defend2,attack1] s=3 : 2.5;
[defend2,attack2] s=3 : 1;
endrewards
const K;
rewards "i_damage"
[defend1,attack1] r=K-1 & s=1 : 0;
[defend1,attack2] r=K-1 & s=1 : 1;
[defend2,attack1] r=K-1 & s=1 : 0.5;
[defend2,attack2] r=K-1 & s=1 : 0;
[defend1,attack1] r=K-1 & s=2 : 1;
[defend1,attack2] r=K-1 & s=2 : 2;
[defend2,attack1] r=K-1 & s=2 : 1.5;
[defend2,attack2] r=K-1 & s=2 : 1;
[defend1,attack1] r=K-1 & s=3 : 1;
[defend1,attack2] r=K-1 & s=3 : 3;
[defend2,attack1] r=K-1 & s=3 : 2.5;
[defend2,attack2] r=K-1 & s=3 : 1;
endrewards