csg
player investor investor endplayer
player market market endplayer
const int months;
module month
m : [0..1];
r : [0..months];
[] m=0 & r<months & !((i=1 & b=0) | i=2) -> (m'=1);
[] m=1 & r<months -> (m'=0) & (r'=r+1);
[] m=0 & (i=2 | (r=months & (i=0 | (i=1 & b=1)))) -> true;
endmodule
module investor
i : [0..2];
[noinvest] m=0 & (i=0 | (i=1 & b=1)) & r<months -> (i'=0);
[invest] m=0 & (i=0 | (i=1 & b=1)) & r<months -> (i'=1);
[cashin] m=0 & i=1 & b=0 -> (i'=2);
endmodule
module market
b : [0..1] init 1;
[nobar] m=0 & r<months & !((i=1 & b=0) | i=2) -> (b'=0);
[bar] m=0 & b=0 & r<months & !((i=1 & b=0) | i=2) -> (b'=1);
endmodule
module value
v : [0..10] init 5;
[] m=1 -> p/10 : (v'=min(v+1,c)) + (1-p/10) : (v'=min(max(v-1,0),c));
endmodule
module probability
p : [0..10] init 5;
[] m=1 & v<5 -> 2/3 : (p'=min(p+1,10)) + 1/3 : (p'=max(p-1,0));
[] m=1 & v=5 -> 1/2 : (p'=min(p+1,10)) + 1/2 : (p'=max(p-1,0));
[] m=1 & v>5 -> 1/3 : (p'=min(p+1,10)) + 2/3 : (p'=max(p-1,0));
endmodule
module cap
c : [0..10] init 10;
[] m=1 -> 1/2 : (c'=max(c-1,0)) + 1/2 : (c'=c);
endmodule
label "finished" = m=0 & (i=2 | ((i=0 | i=1 & b=1) & r=months));
rewards "profit"
[cashin] m=0 & i=1 & b=0 : v;
endrewards
rewards "profit_lc"
[cashin] m=0 & i=1 & b=0 : v * (1 + (r-1)/months);
endrewards
rewards "profit_mc"
[cashin] m=0 & i=1 & b=0 : v * (1 + (r-1)/months) * (1 + mod(r,4)/3);
endrewards
rewards "profit_ec"
[cashin] m=0 & i=1 & b=0 : v * (1 + months/(5*(r+1)));
endrewards