diff --git a/GameOfLife.c b/GameOfLife.c index 807445a057d3e81c75d19c7ad6726acb8af4fcc6..6a8bd0e277519651446a3a8974b56609250425fe 100644 --- a/GameOfLife.c +++ b/GameOfLife.c @@ -113,20 +113,20 @@ void memoryAlloc (game_t *game) void firstGeneration (game_t *game) { int i=1; - char input = 'i'; - /* arrumar esses diabo de char */ - while ( input != 's' ) + int input = 0; + + while ( input != 3 ) { clear (); printGeneration (game); - printf ("\nDigit [a] to add a live cell, [k] to kill a live cell and [s] to start the game.\n"); - scanf (" %c", &input); + printf ("\nDigit [1] to add a live cell, [2] to kill a live cell and [3] to start the game.\n"); + scanf ("%d", &input); - if (input == 'a') + if (input == 1) addCell (game, &i); - else if (input == 'k') + if (input == 2) removeCell (game, &i); } } @@ -301,6 +301,7 @@ void printGeneration (game_t *game) printf ("Generation: %d\n\n", game->generationNumber); + /* Top grid */ printf (" "); for ( j=1; j <= game->this.cols; j++) if (j % 5 == 0 || j == 1) @@ -311,6 +312,7 @@ void printGeneration (game_t *game) for ( i=1; i <= game->this.rows; i++ ) { + /* Left grid */ if (i % 5 == 0 || i == 1) printf ("%2d", i); else @@ -327,6 +329,7 @@ void printGeneration (game_t *game) printf (" !"); } + /* Right grid */ if (i % 5 == 0 || i == 1) printf ("%2d", i); else @@ -335,6 +338,7 @@ void printGeneration (game_t *game) printf ("\n"); } + /* Bottom grid */ printf (" "); for ( j=1; j <= game->this.cols; j++) if (j % 5 == 0 || j == 1) diff --git a/gliderPattern.txt b/gliderPattern.txt deleted file mode 100644 index 72fa6a3c09e7bac2d4deaf9a692d04cedfb31e07..0000000000000000000000000000000000000000 --- a/gliderPattern.txt +++ /dev/null @@ -1,18 +0,0 @@ -100 -300000 -15 -17 17 -17 18 -17 19 -18 17 -19 18 -17 12 -17 13 -17 14 -18 12 -19 13 -12 17 -12 18 -12 19 -13 17 -14 18