Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
Jogo da Vida - Programação 1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Leonardo Krambeck
Jogo da Vida - Programação 1
Commits
0bac18a0
Commit
0bac18a0
authored
5 years ago
by
Leonardo Krambeck
Browse files
Options
Downloads
Patches
Plain Diff
insere caso de teste e calibra cycleTime
parent
4e91744e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
GameOfLife.c
+5
-6
5 additions, 6 deletions
GameOfLife.c
gliderPattern.txt
+18
-0
18 additions, 0 deletions
gliderPattern.txt
with
23 additions
and
6 deletions
GameOfLife.c
+
5
−
6
View file @
0bac18a0
#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
;
floa
t
cycleTime
;
in
t
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
micro
seconds 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
);
u
sleep
(
game
->
cycleTime
);
}
...
...
This diff is collapsed.
Click to expand it.
gliderPattern.txt
0 → 100644
+
18
−
0
View file @
0bac18a0
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment