Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Puissance4_Greub_Remi
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
remi.greub
Puissance4_Greub_Remi
Commits
dc5c9611
Commit
dc5c9611
authored
1 month ago
by
remi.greub
Browse files
Options
Downloads
Patches
Plain Diff
améliorations pour tests unitaires
parent
64c2e016
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
puissance4_GRB/puissance4.c
+4
-5
4 additions, 5 deletions
puissance4_GRB/puissance4.c
with
4 additions
and
5 deletions
puissance4_GRB/puissance4.c
+
4
−
5
View file @
dc5c9611
...
...
@@ -79,6 +79,7 @@ int put_free_cell(struct game *game, int j_p, symbol_t symbol){
int
i
=
0
;
if
((
i
=
is_cell_free
(
game
,
j_p
,
0
,
game
->
players
[
game
->
curr_player
].
symbol
))
!=
-
1
){
game
->
cells
[
j_p
][
i
].
symbol
=
symbol
;
game
->
gamePlayed
-=
1
;
}
return
i
;
}
...
...
@@ -96,7 +97,7 @@ int is_cell_free(struct game *game, int j_p, int i, symbol_t symbol){
if
(
i
<
(
game
->
height
-
1
)){
return
is_cell_free
(
game
,
j_p
,
i
+
1
,
symbol
);
}
else
{
printf
(
"il n'y a plus de case de disponible sur cette colonne
\n
"
);
//
printf("il n'y a plus de case de disponible sur cette colonne\n");
return
-
1
;
}
}
...
...
@@ -118,8 +119,6 @@ int Launch_puissance4(struct game *game){
printf
(
"HEP HEPHEP !! donne un chiffre dans la plage de chiffres indiquée !
\n
"
);
}
}
while
((
chiffre
>=
game
->
width
)
||
(
chiffre
<
0
)
||
is_cell_free
(
game
,
chiffre
,
0
,
game
->
players
[
game
->
curr_player
].
symbol
)
<
0
);
game
->
gamePlayed
-=
1
;
//Complément de verbe du code
int
i
=
0
;
//verifier que put free cell fonctionne
if
((
i
=
put_free_cell
(
game
,
chiffre
,
game
->
players
[
game
->
curr_player
].
symbol
))
<
0
){
...
...
@@ -189,7 +188,6 @@ int Launch_puissance4_randBot(struct game *game, int seed){
}
}
while
((
chiffre
>=
game
->
width
)
||
(
chiffre
<
0
)
||
is_cell_free
(
game
,
chiffre
,
0
,
game
->
players
[
game
->
curr_player
].
symbol
)
<
0
);
}
game
->
gamePlayed
-=
1
;
int
i
=
0
;
//verifier que put free cell fonctionne
if
((
i
=
put_free_cell
(
game
,
chiffre
,
game
->
players
[
game
->
curr_player
].
symbol
))
<
0
){
...
...
@@ -255,7 +253,6 @@ int Launch_puissance4_smartBot(struct game *game, int seed){
}
}
while
((
chiffre
>=
game
->
width
)
||
(
chiffre
<
0
)
||
is_cell_free
(
game
,
chiffre
,
0
,
game
->
players
[
game
->
curr_player
].
symbol
)
<
0
);
}
game
->
gamePlayed
-=
1
;
int
i
=
0
;
//verifier que put free cell fonctionne
if
((
i
=
put_free_cell
(
game
,
chiffre
,
game
->
players
[
game
->
curr_player
].
symbol
))
<
0
){
...
...
@@ -300,6 +297,7 @@ int Launch_puissance4_smartBot(struct game *game, int seed){
int
SmartBot
(
struct
game
*
game
){
int
pos
=
0
;
int
chfr1
=
-
1
,
chfr2
=
-
1
;
int
game_played
=
game
->
gamePlayed
;
for
(
int
chfr
=
0
;
chfr
<
game
->
width
;
chfr
++
){
//verifie que le coup est jouable
if
((
pos
=
put_free_cell
(
game
,
chfr
,
game
->
players
[
game
->
curr_player
].
symbol
))
>=
0
){
...
...
@@ -320,6 +318,7 @@ int SmartBot(struct game *game){
tempCell
->
symbol
=
EMPTY
;
}
}
game
->
gamePlayed
=
game_played
;
if
(
chfr1
!=
-
1
){
return
chfr1
;
}
else
if
(
chfr2
!=
-
1
){
...
...
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