| @@ -5,11 +5,27 @@ |
| 5 | 5 | | #include <time.h> |
| 6 | 6 | | // https://texteditor.com/multiline-text-art/ |
| 7 | 7 | | |
| 8 | + | const char BANNER[][300] = { |
| 9 | + | " ╔════╗ ╔═══╗ ╔═══╗ ╔═══╗", " ║╔╗╔╗║ ║╔═╗║ ║╔═╗║ ║╔═╗║", |
| 10 | + | " ╚╝║║╚╝ ║╚═╝║ ║║ ║║ ║╚══╗", " ║║ ║╔╗╔╝ ║║ ║║ ╚══╗║", |
| 11 | + | " ╔╝╚╗ ║║║╚╗ ║╚═╝║ ║╚═╝║", " ╚══╝ ╚╝╚═╝ ╚═══╝ ╚═══╝", |
| 12 | + | }; |
| 13 | + | |
| 14 | + | const char WINNER[][300] = { |
| 15 | + | "──────────────────────────────────────────", |
| 16 | + | " ╔╗╔╗╔╗╔══╗╔═╗ ╔╗╔═╗ ╔╗╔═══╗╔═══╗╔╗╔╗", |
| 17 | + | " ║║║║║║╚╣╠╝║║╚╗║║║║╚╗║║║╔══╝║╔═╗║║║║║", |
| 18 | + | " ║║║║║║ ║║ ║╔╗╚╝║║╔╗╚╝║║╚══╗║╚═╝║║║║║", |
| 19 | + | " ║╚╝╚╝║ ║║ ║║╚╗║║║║╚╗║║║╔══╝║╔╗╔╝╚╝╚╝", |
| 20 | + | " ╚╗╔╗╔╝╔╣╠╗║║ ║║║║║ ║║║║╚══╗║║║╚╗╔╗╔╗", |
| 21 | + | " ╚╝╚╝ ╚══╝╚╝ ╚═╝╚╝ ╚═╝╚═══╝╚╝╚═╝╚╝╚╝", |
| 22 | + | "──────────────────────────────────────────", |
| 23 | + | }; |
| 24 | + | |
| 8 | 25 | | static const int EASY_SCORE_DECREMENT = 10; |
| 9 | 26 | | static const int MEDIUM_SCORE_DECREMENT = 20; |
| 10 | 27 | | static const int LOWER = 1; |
| 11 | 28 | | static const int UPPER = 4; |
| 12 | | − | |
| 13 | 29 | | typedef enum { |
| 14 | 30 | | Easy, |
| 15 | 31 | | Medium, |
| @@ -36,8 +52,10 @@ int main(int argc, char *argv[]) { |
| 36 | 52 | | int guess; |
| 37 | 53 | | |
| 38 | 54 | | clearscreen(); |
| 39 | | − | printf(COLOR_CYAN); |
| 40 | | − | print_ascii("./assets/banner.txt"); |
| 55 | + | printf(COLOR_CYAN BAR); |
| 56 | + | for (int i = 0; i < 6; i++) { |
| 57 | + | printf("%s\n", BANNER[i]); |
| 58 | + | } |
| 41 | 59 | | Difficulty diff = get_difficulty(); |
| 42 | 60 | | |
| 43 | 61 | | while (level > 0 && level <= 10) { |
| @@ -103,6 +121,7 @@ void decrement_score(Difficulty diff) { |
| 103 | 121 | | Difficulty get_difficulty() { |
| 104 | 122 | | int choice; |
| 105 | 123 | | Difficulty difficulty; |
| 124 | + | printf(COLOR_GREEN BAR COLOR_OFF); |
| 106 | 125 | | printf(COLOR_BOLD COLOR_RED " CHOOSE DIFFICULTY\n"); |
| 107 | 126 | | printf(COLOR_GREEN BAR COLOR_OFF); |
| 108 | 127 | | printf(COLOR_BOLD "[1]" COLOR_OFF " Easy\n"); |
| @@ -121,7 +140,7 @@ Difficulty get_difficulty() { |
| 121 | 140 | | case 3: |
| 122 | 141 | | difficulty = Hard; |
| 123 | 142 | | break; |
| 124 | | − | default: |
| 143 | + | default: |
| 125 | 144 | | printf(COLOR_RED "Invalid Choice. Defaulting to Medium\n" COLOR_OFF); |
| 126 | 145 | | difficulty = Medium; |
| 127 | 146 | | break; |
| @@ -132,7 +151,9 @@ Difficulty get_difficulty() { |
| 132 | 151 | | void level_up() { |
| 133 | 152 | | if (level == 10) { |
| 134 | 153 | | printf(COLOR_YELLOW); |
| 135 | | − | print_ascii("./assets/winner.txt"); |
| 154 | + | for (int i = 0; i < 8; i++) { |
| 155 | + | printf("%s\n", WINNER[i]); |
| 156 | + | } |
| 136 | 157 | | printf(COLOR_OFF); |
| 137 | 158 | | printf("Congratulations!! You WON the game"); |
| 138 | 159 | | exit(1); |
| @@ -149,7 +170,8 @@ void level_down() { |
| 149 | 170 | | level--; |
| 150 | 171 | | size -= 3; |
| 151 | 172 | | } else { |
| 152 | | − | printf("Too many wrong answers!! " COLOR_RED COLOR_BOLD "You Lose!!\n" COLOR_OFF); |
| 173 | + | printf("Too many wrong answers!! " COLOR_RED COLOR_BOLD |
| 174 | + | "You Lose!!\n" COLOR_OFF); |
| 153 | 175 | | exit(1); |
| 154 | 176 | | } |
| 155 | 177 | | } |