-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.c
120 lines (52 loc) · 2.44 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
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
117
#include <stdio.h>
#include "gamelib.h"
#include <time.h>
#include <stdlib.h>
int main() {
int scelta;
int gioco_impostato = 0; // Flag per tenere traccia se il gioco è stato impostato
int num_giocatori;
do {
printf("\n\n.d8888. .o88b. .d8b. db .d88b. d888b d8b db .d8b. .d88b. db db d88888b .d8888. d888888b \n");
printf("88' YP d8P Y8 d8' `8b 88 .8P Y8. 88' Y8b 888o 88 d8' `8b .8P Y8. 88 88 88' 88' YP `~~88~~' \n");
printf(" `Y8b. 8b 88~~~88 88 88 88 88 ooo 88 V8o88 88~~~88 C8888D 88 88 88 88 88~~~~~ `Y8b. 88 \n");
printf("db 8D Y8b d8 88 88 88booo. `8b d8' 88. ~8~ 88 V888 88 88 `8P d8' 88b d88 88. db 8D 88 \n ");
printf("8888Y' `Y88P' YP YP Y88888P `Y88P' Y888P VP V8P YP YP `Y88'Y8 ~Y8888P' Y88888P `8888Y' YP \n");
printf("\n\t\t\t\t\t\tMenu di scelta:\n\n");
printf("\t\t\t\t\t1) Imposta gioco\n");
printf("\t\t\t\t\t2) Gioca\n");
printf("\t\t\t\t\t3) Termina gioco\n");
printf("\t\t\t\t\tScelta: ");
if (scanf("%d", &scelta)){
switch (scelta) {
case 1:
// Impostare il gioco solo se non è già stato impostato
if (!gioco_impostato) {
num_giocatori=imposta_gioco();
gioco_impostato = 1;
} else {
printf("Il gioco è già stato impostato.\n");
}
break;
case 2:
// Giocare solo se il gioco è stato impostato
if (gioco_impostato) {
gioca(num_giocatori);
} else {
printf("Prima di giocare, impostare il gioco.\n");
}
break;
case 3:
// Terminare il gioco
termina_gioco();
break;
default:
printf("Comando non valido. Si prega di inserire 1, 2 o 3.\n");
}
}
else{
while(getchar()!='\n'){}printf("invalid");
}
} while (scelta != 3);
return 0;
}