Commit ed560f99 authored by Chris's avatar Chris
Browse files

fixed print_single_die() code: off by one bounds, added unsigned int

parent b8bbecc1
Loading
Loading
Loading
Loading
+1 −33
Original line number Diff line number Diff line
@@ -71,40 +71,8 @@ static const char *DICE[7][6] = {
	}
};

void print_single_die(int die_value);
void print_single_die(unsigned int die_value);
void print_multiple_dice(int *die_value, int n, int animated);
void clear_dice();

// void print_single_die(int die_value) {
// 	// override invalid values with a blank die (DICE[0])
// 	if (die_value < 0 || die_value > DICE_ARRAY_LENGTH) {
// 		die_value = 0;
// 	}
// 
// 	for (int i = 0; i < DIE_VERTICAL_LENGTH; i++) {
// 		printf("%s\n", DICE[die_value][i]);
// 	}
// }
// 
// void print_multiple_dice(int *die_value, int n, int animated) {
// 	for (int which_row = 0; which_row < DIE_VERTICAL_LENGTH; which_row++) {
// 		for (int j = 0; j < n; j++) {
// 			int which_die = die_value[j];
// 			printf("%s  ", DICE[which_die][which_row]);
// 		}
// 		printf("\n");
// 	}
// }
// 
// // to only be called after print_multiple_dice()
// void clear_dice() {
// 	// move cursor up
// 	// for (int i = 0; i < DIE_VERTICAL_LENGTH + 1; i++) {
// 	for (int i = 0; i < DIE_VERTICAL_LENGTH; i++) {
// 		printf("\033[A"); // move cursor up one line
// 	}
// 	// move cursor all the way to the left
// 	printf("\r");
// }

#endif //GRAPHICS_H_
(17.1 KiB)

File changed.

No diff preview for this file type.