
February 26th, 2004, 09:16 AM
|
Second Lieutenant
|
|
Join Date: Jan 2004
Posts: 510
Thanks: 24
Thanked 31 Times in 12 Posts
|
|
Re: 2.08 and Incompatible Battle Reports
Quote:
Originally posted by alexti:
code:
if (x + 2d6 < y + 2d6)
To eliminate this problem you could make the function:
code:
int random_compare(int x, int y, int nx, int ny)
{
int x1 = x + nx*illwinter_dice();
int y1 = y + ny*illwinter_dice();
return (x1 - y1);
}
and use comparison
code:
if (0 > random_compare(x,y,2,2))
|
A nice idea, though it fails in the execution. 2d6 is not shorthand for two times the result of a d6, but for the openended result of rolling 2 d6'es (openended: sixes are rerolled and added potentially ad infinitum
Easy enough to modify, of course, though it makes for ugly code and only deals with inequalities. The order of evaluation problem can occur anywhere where two random calls are used within the same expression.
__________________
When I said Death before Dishonour, I meant alphabetically.
|