From 0bac18a013939b121a094b1d085ce41dcb0c0ade Mon Sep 17 00:00:00 2001
From: Leonardo Krambeck <lk19@inf.ufpr.br>
Date: Fri, 11 Oct 2019 04:11:52 -0300
Subject: [PATCH] insere caso de teste e calibra cycleTime

---
 GameOfLife.c      | 11 +++++------
 gliderPattern.txt | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 6 deletions(-)
 create mode 100644 gliderPattern.txt

diff --git a/GameOfLife.c b/GameOfLife.c
index e5d2877..2b88aa1 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 0000000..72fa6a3
--- /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
-- 
GitLab