Loading gamelogic.c +3 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ #include <stdlib.h> #include <stdio.h> #include <time.h> #include <string.h> #include "gamelogic.h" #include "graphics.h" #include "menu.h" Loading Loading @@ -173,9 +172,10 @@ unsigned int calculate_selection_score(game_context *ctx, enum scorecard_command } points_awarded = ctx->game_state.scorecard.large_straight; break; unsigned int three_of_a_kind_value; case FULL_HOUSE: // 25 points for a combination of three of one number + two of another; 0 otherwise unsigned int three_of_a_kind_value = n_of_a_kind(ctx->game_state.dice, NUM_DICE, 3, 0); three_of_a_kind_value = n_of_a_kind(ctx->game_state.dice, NUM_DICE, 3, 0); unsigned int two_of_a_kind_value = 0; if (three_of_a_kind_value) { two_of_a_kind_value = n_of_a_kind(ctx->game_state.dice, NUM_DICE, 2, three_of_a_kind_value); Loading Loading @@ -252,7 +252,7 @@ void hold_dice_with_menu(struct die_st *dice, unsigned int num_dice) { dice_hold_selections[i].enabled = 1; } char *action = menu_prompt_multi_select(dice_hold_selections, num_dice, "Hold dice", "held"); menu_prompt_multi_select(dice_hold_selections, num_dice, "Hold dice", "held"); for (unsigned int i = 0; i < num_dice; i++) { dice[i].held = dice_hold_selections[i].multi_selected; Loading menu.c +1 −2 Original line number Diff line number Diff line // menu.c #include <stdio.h> #include <string.h> #include "menu.h" MENU_DIRECTION get_direction(void); Loading Loading @@ -70,7 +69,7 @@ int menu_prompt(const menu_item *items, unsigned int num_menu_items, const char return selected_action; } char *menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label) { void menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label) { printf("%s\n", title); printf("Press SPACE to select an item. Press ENTER to make your selection.\n"); Loading menu.h +1 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,6 @@ typedef struct { } menu_item; int menu_prompt(const menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label); char *menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label); void menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label); #endif //MENU_H utils.c +0 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> // timespec struct #include "utils.h" Loading yaht.c +0 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ #include "gamelogic.h" #include "menu.h" #include "utils.h" #include <string.h> // yaht.c // Copyright (c) 2025 Loading Loading
gamelogic.c +3 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ #include <stdlib.h> #include <stdio.h> #include <time.h> #include <string.h> #include "gamelogic.h" #include "graphics.h" #include "menu.h" Loading Loading @@ -173,9 +172,10 @@ unsigned int calculate_selection_score(game_context *ctx, enum scorecard_command } points_awarded = ctx->game_state.scorecard.large_straight; break; unsigned int three_of_a_kind_value; case FULL_HOUSE: // 25 points for a combination of three of one number + two of another; 0 otherwise unsigned int three_of_a_kind_value = n_of_a_kind(ctx->game_state.dice, NUM_DICE, 3, 0); three_of_a_kind_value = n_of_a_kind(ctx->game_state.dice, NUM_DICE, 3, 0); unsigned int two_of_a_kind_value = 0; if (three_of_a_kind_value) { two_of_a_kind_value = n_of_a_kind(ctx->game_state.dice, NUM_DICE, 2, three_of_a_kind_value); Loading Loading @@ -252,7 +252,7 @@ void hold_dice_with_menu(struct die_st *dice, unsigned int num_dice) { dice_hold_selections[i].enabled = 1; } char *action = menu_prompt_multi_select(dice_hold_selections, num_dice, "Hold dice", "held"); menu_prompt_multi_select(dice_hold_selections, num_dice, "Hold dice", "held"); for (unsigned int i = 0; i < num_dice; i++) { dice[i].held = dice_hold_selections[i].multi_selected; Loading
menu.c +1 −2 Original line number Diff line number Diff line // menu.c #include <stdio.h> #include <string.h> #include "menu.h" MENU_DIRECTION get_direction(void); Loading Loading @@ -70,7 +69,7 @@ int menu_prompt(const menu_item *items, unsigned int num_menu_items, const char return selected_action; } char *menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label) { void menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label) { printf("%s\n", title); printf("Press SPACE to select an item. Press ENTER to make your selection.\n"); Loading
menu.h +1 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,6 @@ typedef struct { } menu_item; int menu_prompt(const menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label); char *menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label); void menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, const char *title, const char *item_disabled_label); #endif //MENU_H
utils.c +0 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> // timespec struct #include "utils.h" Loading
yaht.c +0 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ #include "gamelogic.h" #include "menu.h" #include "utils.h" #include <string.h> // yaht.c // Copyright (c) 2025 Loading