diff options
| -rw-r--r-- | ytz.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -83,6 +83,20 @@ uint16_t roll_die(uint16_t* seed) { return (m >> 16) + 1; /* we ultimately want [1,7) */ } +void print_dice(ytz_state* state) { + char* label = "die %d "; + char* top = ",---,"; + char* mid = "| %d | "; + char* bot = "'---'"; + + for (int i = 0; i < 5; i++) + printf(label, i); + printf("\n%s %s %s %s %s\n", top, top, top, top, top); + for (int i = 0; i < 5; i++) + printf(mid, GET_D(state->dice, i)); + printf("\n%s %s %s %s %s\n", bot, bot, bot, bot, bot); +} + void ask_for_rerolls(ytz_state* state) { char buf[10]; printf("which dice should be re-rolled? "); @@ -139,13 +153,6 @@ void main() { * */ - printf("roll: %d\n", GET_ROLL(y.topflag_w_roll)); - printf("d1: %d\n", GET_D0(y.dice)); - printf("d2: %d\n", GET_D1(y.dice)); - printf("d3: %d\n", GET_D2(y.dice)); - printf("d4: %d\n", GET_D3(y.dice)); - printf("d5: %d\n", GET_D4(y.dice)); - do_turn(&y); printf("new roll: %d\n", GET_ROLL(y.topflag_w_roll)); @@ -154,6 +161,8 @@ void main() { printf("new d3: %d\n", GET_D2(y.dice)); printf("new d4: %d\n", GET_D3(y.dice)); printf("new d5: %d\n", GET_D4(y.dice)); + + print_dice(&y); ask_for_rerolls(&y); do_turn(&y); |
