Dice Mechanic counting even/odd/doubles/max Implementation

Dice Mechanic counting even/odd/doubles/max Implementation

Return to topic list

Tue Jan 6 03:56:13 2015   by   Rob Muadib
Torben

Hello, So working on dice mechanic inspired by a Burnt Centauri's post on reddit. here http://www.reddit.com/r/rpg/comments/1w3e79/homebrew_system_how_to_do_base_stats/ (the mechanics writeup is futher down the thread.) In his system, he rolls pairs of different size (# of sides) dices. 2D4/2D6, and odd pairs, D6+D4 etc. And then has several open ending options. First is max result, the highest thrown on each die, which is pretty easy to implement. Second is Doubles thrown, very easy to implement. Then he looks for evens pairs ( 2,4, 4,6, 6,8) thrown (discounting doubles versions sicne we already look for those.) Finally, he adds in Odd pairs (1,3;3,5;5,7) etc.

How would I impelement a check for odd/even numbers. I haven't seen any built in function for this?

I appreciate any help you an provide.

Best Regards,

Rob
 
Tue Jan 6 10:43:52 2015   by   Torben
To test if a value x is even, you can do

if (x mod 2) = 0 then ... else ...

where mod is the modulo operator.  To test if x is odd, you can do

if (x mod 2) = 1 then ... else ...
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list