Unverified Commit c3271473 authored by Thomas R. Koll's avatar Thomas R. Koll
Browse files

Also print face value sum of thrown dice

parent 12542d92
......@@ -58,13 +58,20 @@ const unsigned int protectedFields = 0b1111111110001; // it's just one field in
Game game;
int diceValue(int dice) {
if(dice > 0) {
return diceValue(dice >> 1) + (dice & 0b1);
}
return 0;
}
void throwDice( int dice) {
dice = 0;
for (int i = 0; i < 4; i++ ) {
dice = (dice << 1) | (rand() % 2);
}
#ifdef DEBUG
printf("Thrown dice: %s\n", binpad(dice, 4));
printf("Thrown dice: %s: %i\n", binpad(dice, 4), diceValue(dice));
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment