Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Groupe3-TicTacToe
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
BAHRMAN Louis
Groupe3-TicTacToe
Commits
354446df
Commit
354446df
authored
Apr 21, 2020
by
HERSEMEULE Bruce
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Bruce' into 'master'
Mise à jour de arbre MinMax See merge request
!7
parents
49d11e8c
5f1491d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
24 deletions
+26
-24
ArbreMinMax.class
build/classes/tictactoecodingame/ArbreMinMax.class
+0
-0
ArbreMinMax.java
src/tictactoecodingame/ArbreMinMax.java
+26
-24
No files found.
build/classes/tictactoecodingame/ArbreMinMax.class
View file @
354446df
No preview for this file type
src/tictactoecodingame/ArbreMinMax.java
View file @
354446df
...
@@ -14,7 +14,6 @@ import static tictactoecodingame.Generator.random_tests;
...
@@ -14,7 +14,6 @@ import static tictactoecodingame.Generator.random_tests;
*/
*/
public
class
ArbreMinMax
{
public
class
ArbreMinMax
{
public
static
int
N
=
5
;
protected
int
value
;
protected
int
value
;
protected
ArrayList
<
Coup
>
coups
;
protected
ArrayList
<
Coup
>
coups
;
protected
ArrayList
<
ArbreMinMax
>
fils
;
protected
ArrayList
<
ArbreMinMax
>
fils
;
...
@@ -54,8 +53,13 @@ public class ArbreMinMax {
...
@@ -54,8 +53,13 @@ public class ArbreMinMax {
}
}
public
ArrayList
<
ArbreMinMax
>
getfils
(){
public
ArrayList
<
ArbreMinMax
>
getfils
(){
if
(
fils
!=
null
){
return
(
fils
);
return
(
fils
);
}
}
else
{
return
null
;
}
}
public
ArrayList
getcoups
(){
public
ArrayList
getcoups
(){
return
(
coups
);
return
(
coups
);
...
@@ -124,29 +128,27 @@ public class ArbreMinMax {
...
@@ -124,29 +128,27 @@ public class ArbreMinMax {
return
m
;
return
m
;
}
}
public
void
MinMax
(
int
h
,
Plateau
plateau
,
int
nb_tests
){
public
void
MinMax
(
int
c
){
// h = hauteur, on l'incrémente comme un compteur
// c = compteur
// N est la profondeur à explorer en MinMax, toutes les feuilles en N+1 sont évaluées
// Le compteur doit être initialisé à 0 donc pair -> Max, impair -> Min
// La racine est un Max, donc impair -> Max, pair -> Min
if
(
N
>=
h
){
// On doit chosir entre min et max
if
(
this
.
getfils
()
!=
null
){
if
(
h
%
2
==
0
){
int
a
=
this
.
getfils
().
size
();
for
(
int
i
=
0
;
i
<
a
;
i
++){
this
.
getfils
().
get
(
i
).
MinMax
(
c
+
1
);
}
}
if
(
c
%
2
==
0
){
//On attribue le Min
//On attribue le Min
int
m
=
this
.
Min
();
int
m
=
this
.
Min
();
this
.
setvalue
(
m
);
this
.
setvalue
(
m
);
}
}
else
{
else
{
//On attribue le max
//On attribue le max
int
m
=
this
.
Max
();
int
m
=
this
.
Max
();
this
.
setvalue
(
m
);
this
.
setvalue
(
m
);
}
}
int
a
=
this
.
getfils
().
size
();
for
(
int
i
=
0
;
i
<
a
;
i
++){
this
.
getfils
().
get
(
i
).
MinMax
(
h
+
1
,
plateau
,
nb_tests
);
}
}
else
{
//On a h > N, on utilise la fonction d'évaluation
int
i
=
random_tests
(
plateau
,
nb_tests
);
}
}
}
}
}
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