Skip to content
Snippets Groups Projects
Commit 0bac18a0 authored by Leonardo Krambeck's avatar Leonardo Krambeck
Browse files

insere caso de teste e calibra cycleTime

parent 4e91744e
No related branches found
No related tags found
No related merge requests found
#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);
}
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment