-
Notifications
You must be signed in to change notification settings - Fork 0
/
final_othello_no_sdl.c
117 lines (98 loc) · 2.08 KB
/
final_othello_no_sdl.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "logged_in.h"
/*
########################## ATTENTION! #####################################
->Le nom des variables commence par leur type (i:int, s:string:, c:char...).
->Pour les variables globales le nom commence d'abord par "g" suivi de leur type.
#################################################################################
*/
//char g_s_nom1[20]="Player 1";
//char g_s_nom2[20]="Player 2";
//char g_s_ai[20] = "Fael2.0";
int main(int argc, char* argv[])
{
srand(time(NULL));
int i_quit=0; //pour revenir au menu de log in/ sign up;
int i_log=1;
char c_choix = '1', c_choix1, c_choix2;
int i_board[9][9];
init_board(i_board);
while (1)
{
menu();
scanf("%c", &c_choix);
switch (c_choix)
{
case '0': //quitter
{
printf("Etes-vous s\226r de vouloir quitter?\n");
printf("0.Oui 1.Non\n");
getchar();
c_choix2 = getchar();
switch (c_choix2)
{
case '0':
{
return 0;
}
case '1':
default:
{
break;
}
}
break;
}
case '1': //login
{
i_log = login();
while (i_log==0)
{
printf("\nVous avez saisie le mauvais identifiant ou votre compte n'existe pas.\n");
printf("\nSaisir '0' pour revenir au menu principal ou n'importe quelle autre touche pour corriger votre identifiant.\n");
getchar();
g_i_erreur = getchar();
if (g_i_erreur == '0')
{
break;
}
i_log = login();
}
if (g_i_erreur == '0')
{
break;
}
}
case '2': //sign in
{
if (c_choix == '2')
{
int signed_up= signUp();
if(!signed_up) //sign up failed
{
getchar();
getchar();
break;
}
}
menu1();
getchar();
c_choix1 = getchar();
i_quit=logged_in(c_choix1,i_board);
if(i_quit!=0)
{
break;
}
break;
}
default:
{
break;
}
}
}
return 0;
}