1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
int throw_treble(int d, int p) {
// return result of throwing for treble d with accuracy p% (o<90)
// Board neighbours ignoring slot zero
int bd[2][21]={{0,20,15,17,18,12,13,19,16,14,6,8,9,4,11,10,7,2,1,3,5},
{0,18,17,19,13,20,10,16,11,12,15,14,5,6,9,2,8,3,4,7,1}};
int r = rand()%100;
if(r<p)
return 3*d;
else if(r<90)
return d;
else if(r<93)
return 3*bd[0][d];
else if (r<96)
return 3*bd[1][d];
else if(r<98)
return bd[0][d];
else
return bd[1][d];
}
|