-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
56 lines (43 loc) · 1.4 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "../libs/main.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "./configuration/main.h"
#include "./macros.h"
#include "./play/main.h"
#include "./show-ranking/main.h"
int main(const int argsLength, char* args[]) {
unsigned char error;
Configuration config;
int userInput;
error = getConfiguration(&config, CONFIGURATION_PATH);
if (error) {
printf("> Error! An error occurred on get the configuration.");
return 1;
};
printf("> %s team - A Tic-Tac-Toe game developed with C...", DEVELOPMENT_TEAM);
printf("\n\n> Available options:\n\n%s%s%s", " 1 - Play Tic-Tac-Toe.\n", " 2 - Show ranking.\n",
" 0 - Exit.\n");
printf("\n> Select an option: ");
fflush(stdin);
scanf("%d", &userInput);
while (userInput != 0) {
switch (userInput) {
case 1:
printf("\n> Team %s...\n\n", config.teamName);
playTicTacToe(&config);
break;
case 2:
showRanking(&config);
break;
default:
printf("\n> Invalid option! Try again...");
};
printf("> Available options:\n\n%s%s%s", " 1 - Play Tic-Tac-Toe.\n", " 2 - Show ranking.\n",
" 0 - Exit.\n");
printf("\n> Select an option: ");
fflush(stdin);
scanf("%d", &userInput);
};
return 0;
}