Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Projet_info
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TRAN Alain
Projet_info
Commits
2b4df17a
Commit
2b4df17a
authored
May 02, 2020
by
TRAN Alain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace AlgoRechercheMinMax_9x9.java
parent
f969440d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
AlgoRechercheMinMax_9x9.java
src/tictactoecodingame/AlgoRechercheMinMax_9x9.java
+5
-4
No files found.
src/tictactoecodingame/AlgoRechercheMinMax_9x9.java
View file @
2b4df17a
...
@@ -31,14 +31,14 @@ public class AlgoRechercheMinMax_9x9 extends AlgoRecherche {
...
@@ -31,14 +31,14 @@ public class AlgoRechercheMinMax_9x9 extends AlgoRecherche {
double
bestScore
=
-
1
*
inf
;
double
bestScore
=
-
1
*
inf
;
CoupTicTacToe
meilleur_coup
=
null
;
CoupTicTacToe
meilleur_coup
=
null
;
ArrayList
<
Coup
>
coups
=
_plateau
.
getListeCoups
(
ordi
);
ArrayList
<
Coup
>
coups
=
_plateau
.
getListeCoups
(
ordi
);
GrilleTicTacToe9x9
_plateau1
=
(
GrilleTicTacToe9x9
)
_plateau
;
//
GrilleTicTacToe9x9 _plateau1 = (GrilleTicTacToe9x9) _plateau;
for
(
int
i
=
0
;
i
<
coups
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
coups
.
size
();
i
++){
_plateau
.
sauvegardePosition
(
0
);
_plateau
.
sauvegardePosition
(
0
);
_plateau
.
joueCoup
(
coups
.
get
(
i
));
_plateau
.
joueCoup
(
coups
.
get
(
i
));
// System.out.println(_plateau);
// System.out.println(_plateau);
// System.out.println("coup initial");
// System.out.println("coup initial");
double
score
=
minimax
(
_plateau
1
,
humain
,
1
,
false
);
//False car l'ordi a déjà placé son premier coup
double
score
=
minimax
(
_plateau
,
humain
,
1
,
false
);
//False car l'ordi a déjà placé son premier coup
Coup
coup_provisoire
=
coups
.
get
(
i
);
Coup
coup_provisoire
=
coups
.
get
(
i
);
_plateau
.
restaurePosition
(
0
);
_plateau
.
restaurePosition
(
0
);
// System.out.println("annule coup initial");
// System.out.println("annule coup initial");
...
@@ -52,7 +52,7 @@ public class AlgoRechercheMinMax_9x9 extends AlgoRecherche {
...
@@ -52,7 +52,7 @@ public class AlgoRechercheMinMax_9x9 extends AlgoRecherche {
// changer le tour du joueur
// changer le tour du joueur
}
}
public
double
minimax
(
GrilleTicTacToe9x9
_plateau
,
Joueur
_joueur
,
int
profondeur
,
boolean
isMaximizing
){
public
double
minimax
(
Plateau
_plateau
,
Joueur
_joueur
,
int
profondeur
,
boolean
isMaximizing
){
if
(
_plateau
.
partieTerminee
()){
if
(
_plateau
.
partieTerminee
()){
if
(
_plateau
.
partieNulle
()){
if
(
_plateau
.
partieNulle
()){
...
@@ -120,7 +120,8 @@ public class AlgoRechercheMinMax_9x9 extends AlgoRecherche {
...
@@ -120,7 +120,8 @@ public class AlgoRechercheMinMax_9x9 extends AlgoRecherche {
}
}
}
}
public
double
evaluation
(
GrilleTicTacToe9x9
_plateau
){
public
double
evaluation
(
Plateau
_plateau1
){
GrilleTicTacToe9x9
_plateau
=
(
GrilleTicTacToe9x9
)
_plateau1
;
double
delta
=
0
;
double
delta
=
0
;
for
(
int
i
=
0
;
i
<
3
;
i
++){
// abscisse de la case 3x3
for
(
int
i
=
0
;
i
<
3
;
i
++){
// abscisse de la case 3x3
for
(
int
j
=
0
;
j
<
3
;
j
++){
//ordonnée de la case 3x3
for
(
int
j
=
0
;
j
<
3
;
j
++){
//ordonnée de la case 3x3
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment