@@ -11,11 +11,12 @@ int main() {
11
11
int cols = DASHBOARD_COLS ;
12
12
13
13
char * requestedPattern ;
14
- char * maxGenerations ;
14
+ char * maxGeneration ;
15
15
char * delayBetweenGenerations ;
16
16
char delayBetweenGenerationsMsg [120 ];
17
+ char * platformSelected ;
17
18
18
- int maxGenerationsInt ;
19
+ int maxGenerationInt ;
19
20
int delayBetweenGenerationsInt ;
20
21
21
22
game .dashboard = dashboard ;
@@ -32,7 +33,7 @@ int main() {
32
33
/* ----------------------------- Request Pattern ---------------------------- */
33
34
34
35
requestedPattern = getUserInputStr (
35
- "> Which pattern do you want ('Glider','Toad', 'Press', or 'Glider cannon')? " ,
36
+ "> Which pattern do you want? ('Glider','Toad', 'Press', or 'Glider cannon'): " ,
36
37
"> Invalid pattern! Try again..." , 50 , & validatePattern );
37
38
38
39
printf ("> Pattern received: '%s'.\n\n" , requestedPattern );
@@ -41,23 +42,23 @@ int main() {
41
42
42
43
/* ----------------------- Request Maximum Generation ----------------------- */
43
44
44
- maxGenerations = getUserInputStr (
45
+ maxGeneration = getUserInputStr (
45
46
"> Which is maximum generation do you want? (a negative number is equal to infinity): " ,
46
47
"> Invalid generation! Try again..." , 10 , & validateGeneration );
47
48
48
- sscanf (maxGenerations , "%d" , & maxGenerationsInt );
49
+ sscanf (maxGeneration , "%d" , & maxGenerationInt );
49
50
50
- if (maxGenerationsInt < 0 ) {
51
- maxGenerations = "'infinity'" ;
52
- maxGenerationsInt = INT_MAX ;
51
+ if (maxGenerationInt < 0 ) {
52
+ maxGeneration = "'infinity'" ;
53
+ maxGenerationInt = INT_MAX ;
53
54
};
54
55
55
- printf ("> Maximum generation received: %s.\n\n" , maxGenerations );
56
+ printf ("> Maximum generation received: %s.\n\n" , maxGeneration );
56
57
57
58
/* ------------------------------ Request Delay ----------------------------- */
58
59
59
60
sprintf (delayBetweenGenerationsMsg ,
60
- "> What should be the miliseconds delay between generations? (must be between %d and "
61
+ "> What should be the milliseconds delay between generations? (must be between %d and "
61
62
"%d, both included): " ,
62
63
MINIMUM_DELAY , MAXIMUM_DELAY );
63
64
@@ -66,7 +67,23 @@ int main() {
66
67
67
68
sscanf (delayBetweenGenerations , "%d" , & delayBetweenGenerationsInt );
68
69
69
- printf ("> Delay received: %s miliseconds.\n" , delayBetweenGenerations );
70
+ printf ("> Delay received: %s milliseconds.\n\n" , delayBetweenGenerations );
71
+
72
+ /* ---------------------------- Request Platform ---------------------------- */
73
+
74
+ platformSelected = getUserInputStr (
75
+ "> In which platform do you want to start the Conway's Game of Life game? (console, or "
76
+ "Simple DirectMedia Layer (SDL)): " ,
77
+ "> Invalid option! Try again..." , 32 , & validatePlatform );
78
+
79
+ printf ("> Platform selected: '%s'.\n" , platformSelected );
80
+
81
+ if (strcmpi (platformSelected , "console" ) == 0 ) {
82
+ startGameByConsole (& game , maxGenerationInt , delayBetweenGenerationsInt );
83
+ return 0 ;
84
+ }
85
+
86
+ // TODO: Start game in SDL.
70
87
71
88
return 0 ;
72
89
}
0 commit comments