@@ -11,11 +11,12 @@ int main() {
1111 int cols = DASHBOARD_COLS ;
1212
1313 char * requestedPattern ;
14- char * maxGenerations ;
14+ char * maxGeneration ;
1515 char * delayBetweenGenerations ;
1616 char delayBetweenGenerationsMsg [120 ];
17+ char * platformSelected ;
1718
18- int maxGenerationsInt ;
19+ int maxGenerationInt ;
1920 int delayBetweenGenerationsInt ;
2021
2122 game .dashboard = dashboard ;
@@ -32,7 +33,7 @@ int main() {
3233 /* ----------------------------- Request Pattern ---------------------------- */
3334
3435 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'): " ,
3637 "> Invalid pattern! Try again..." , 50 , & validatePattern );
3738
3839 printf ("> Pattern received: '%s'.\n\n" , requestedPattern );
@@ -41,23 +42,23 @@ int main() {
4142
4243 /* ----------------------- Request Maximum Generation ----------------------- */
4344
44- maxGenerations = getUserInputStr (
45+ maxGeneration = getUserInputStr (
4546 "> Which is maximum generation do you want? (a negative number is equal to infinity): " ,
4647 "> Invalid generation! Try again..." , 10 , & validateGeneration );
4748
48- sscanf (maxGenerations , "%d" , & maxGenerationsInt );
49+ sscanf (maxGeneration , "%d" , & maxGenerationInt );
4950
50- if (maxGenerationsInt < 0 ) {
51- maxGenerations = "'infinity'" ;
52- maxGenerationsInt = INT_MAX ;
51+ if (maxGenerationInt < 0 ) {
52+ maxGeneration = "'infinity'" ;
53+ maxGenerationInt = INT_MAX ;
5354 };
5455
55- printf ("> Maximum generation received: %s.\n\n" , maxGenerations );
56+ printf ("> Maximum generation received: %s.\n\n" , maxGeneration );
5657
5758 /* ------------------------------ Request Delay ----------------------------- */
5859
5960 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 "
6162 "%d, both included): " ,
6263 MINIMUM_DELAY , MAXIMUM_DELAY );
6364
@@ -66,7 +67,23 @@ int main() {
6667
6768 sscanf (delayBetweenGenerations , "%d" , & delayBetweenGenerationsInt );
6869
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.
7087
7188 return 0 ;
7289}
0 commit comments