diff --git a/GameOfLife.c b/GameOfLife.c index e5d28776e70731557eb0f56f6351f1f9c5b8e554..2b88aa11178761cf4d00bdbf1c696b37c4c34d6d 100644 --- a/GameOfLife.c +++ b/GameOfLife.c @@ -1,6 +1,5 @@ #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <unistd.h> typedef struct Generation { @@ -14,7 +13,7 @@ typedef struct Game { generation_t next; int generationNumber; int totalGenerations; - float cycleTime; + int cycleTime; } game_t; #define ALIVE 1 @@ -66,8 +65,8 @@ void startGame (game_t *game, char **argv) printf ("How many generations do you want to simulate?\n"); scanf ("%d", &game->totalGenerations); - printf ("How many seconds do you want each generation to last?\n"); - scanf ("%f", &game->cycleTime); + printf ("How many microseconds do you want each generation to last?\n"); + scanf ("%d", &game->cycleTime); } void defineSizes (game_t *game, char **argv) @@ -155,7 +154,7 @@ void playGame (game_t *game) printGeneration (game); } - sleep (5); + sleep (3); clear(); } @@ -175,7 +174,7 @@ void printGeneration (game_t *game) printf ("\n"); } - sleep (game->cycleTime); + usleep (game->cycleTime); } diff --git a/gliderPattern.txt b/gliderPattern.txt new file mode 100644 index 0000000000000000000000000000000000000000..72fa6a3c09e7bac2d4deaf9a692d04cedfb31e07 --- /dev/null +++ b/gliderPattern.txt @@ -0,0 +1,18 @@ +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