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
9e84e86a
Commit
9e84e86a
authored
5 years ago
by
Leonardo Krambeck
Browse files
Options
Downloads
Patches
Plain Diff
muda input pra int inves de char
parent
7a2bca0a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
GameOfLife.c
+11
-7
11 additions, 7 deletions
GameOfLife.c
gliderPattern.txt
+0
-18
0 additions, 18 deletions
gliderPattern.txt
with
11 additions
and
25 deletions
GameOfLife.c
+
11
−
7
View file @
9e84e86a
...
...
@@ -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
(
"
\n
Digit [
a
] to add a live cell, [
k
] to kill a live cell and [
s
] to start the game.
\n
"
);
scanf
(
"
%c
"
,
&
input
);
printf
(
"
\n
Digit [
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
)
...
...
This diff is collapsed.
Click to expand it.
gliderPattern.txt
deleted
100644 → 0
+
0
−
18
View file @
7a2bca0a
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