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
87948af0
Commit
87948af0
authored
Apr 27, 2020
by
BAHRMAN Louis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Louis' into 'master'
Louis See merge request
!15
parents
c2877500
56188e0b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
19 deletions
+106
-19
.gitkeep
build/classes/.gitkeep
+0
-0
.netbeans_automatic_build
build/classes/.netbeans_automatic_build
+0
-0
.netbeans_update_resources
build/classes/.netbeans_update_resources
+0
-0
builder.jar
build/classes/builder.jar
+0
-0
private.properties
nbproject/private/private.properties
+36
-0
ArbreMCTS.java
src/tictactoecodingame/ArbreMCTS.java
+21
-19
Selection.java
src/tictactoecodingame/Selection.java
+49
-0
No files found.
build/classes/.gitkeep
deleted
100644 → 0
View file @
c2877500
build/classes/.netbeans_automatic_build
deleted
100644 → 0
View file @
c2877500
build/classes/.netbeans_update_resources
deleted
100644 → 0
View file @
c2877500
build/classes/builder.jar
deleted
100644 → 0
View file @
c2877500
File deleted
nbproject/private/private.properties
View file @
87948af0
<<<<<<<
HEAD
<<<<<<<
HEAD
<<<<<<<
HEAD
compile.on.save
=
true
do.depend
=
false
do.jar
=
true
javac.debug
=
true
javadoc.preview
=
true
user.properties.file
=
C:
\\
Users
\\
timot
\\
AppData
\\
Roaming
\\
NetBeans
\\
11.2
\\
build.properties
=======
compile.on.save
=
true
do.depend
=
false
do.jar
=
true
javac.debug
=
true
javadoc.preview
=
true
user.properties.file
=
/home/louis/.netbeans/11.3/build.properties
>>>>>>>
4dd14568c244c833d17b679f8f3b340f997c8d04
=
======
<<<<<<<
HEAD
compile.on.save
=
true
do.depend
=
false
do.jar
=
true
javac.debug
=
true
javadoc.preview
=
true
user.properties.file
=
C:
\\
Users
\\
timot
\\
AppData
\\
Roaming
\\
NetBeans
\\
11.2
\\
build.properties
=======
compile.on.save
=
true
do.depend
=
false
do.jar
=
true
javac.debug
=
true
javadoc.preview
=
true
user.properties.file
=
/home/louis/.netbeans/11.3/build.properties
>>>>>>>
4dd14568c244c833d17b679f8f3b340f997c8d04
>>>>>>>
4f5ab9d710d3dfdc1fe71236031395a85db95bec
=
======
<<<<<<<
HEAD
<<<<<<<
HEAD
compile.on.save
=
true
compile.on.save
=
true
do.depend
=
false
do.depend
=
false
...
@@ -13,3 +48,4 @@ javac.debug=true
...
@@ -13,3 +48,4 @@ javac.debug=true
javadoc.preview
=
true
javadoc.preview
=
true
user.properties.file
=
C:
\\
Users
\\
theo
\\
AppData
\\
Roaming
\\
NetBeans
\\
11.3
\\
build.properties
user.properties.file
=
C:
\\
Users
\\
theo
\\
AppData
\\
Roaming
\\
NetBeans
\\
11.3
\\
build.properties
>>>>>>>
4dd14568c244c833d17b679f8f3b340f997c8d04
>>>>>>>
4dd14568c244c833d17b679f8f3b340f997c8d04
>>>>>>>
94177790fa8a419aa9237d306f5420565be1ebd3
src/tictactoecodingame/Arbre.java
→
src/tictactoecodingame/Arbre
MCTS
.java
View file @
87948af0
...
@@ -11,61 +11,63 @@ import java.util.ArrayList;
...
@@ -11,61 +11,63 @@ import java.util.ArrayList;
*
*
* @author senda
* @author senda
*/
*/
public
class
Arbre
{
public
class
ArbreMCTS
{
public
static
int
N
=
5
;
protected
Fraction
value
;
protected
ArrayList
<
Coup
>
coups
;
protected
ArrayList
<
Arbre
>
fils
;
// Les constructeurs :
private
Fraction
value
;
private
ArrayList
<
Coup
>
coups
;
public
Arbre
(){
private
ArrayList
<
ArbreMCTS
>
fils
;
}
public
Arbre
(
Fraction
value
,
ArrayList
coups
,
ArrayList
fils
){
// Les constructeurs :
public
ArbreMCTS
(
Fraction
value
,
ArrayList
coups
,
ArrayList
fils
){
this
.
value
=
value
;
this
.
value
=
value
;
this
.
fils
=
fils
;
this
.
fils
=
fils
;
this
.
coups
=
coups
;
this
.
coups
=
coups
;
}
}
public
Arbre
(
int
num
,
int
den
,
ArrayList
coups
,
ArrayList
fils
){
public
ArbreMCTS
(
int
den
,
int
num
,
ArrayList
coups
,
ArrayList
fils
){
this
.
value
.
den
=
den
;
this
.
value
.
den
=
den
;
this
.
value
.
num
=
num
;
this
.
value
.
num
=
num
;
this
.
fils
=
fils
;
this
.
fils
=
fils
;
this
.
coups
=
coups
;
this
.
coups
=
coups
;
}
}
public
Arbre
(
Fraction
value
,
Plateau
_plateau
,
Joueur
_joueur
){
public
Arbre
MCTS
(
Fraction
value
,
Plateau
_plateau
,
Joueur
_joueur
){
this
.
value
=
value
;
this
.
value
=
value
;
this
.
coups
=
_plateau
.
getListeCoups
(
_joueur
)
;
this
.
coups
=
_plateau
.
getListeCoups
(
_joueur
)
;
int
a
=
coups
.
size
();
int
a
=
coups
.
size
();
fils
=
new
ArrayList
();
fils
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
a
;
i
++){
for
(
int
i
=
0
;
i
<
a
;
i
++){
Arbre
Arbre_i
=
new
Arbre
(
new
Fraction
());
// Attention ! Ce constructeur initialise donc avec des valeurs nulles en racine !
Arbre
MCTS
Arbre_i
=
new
ArbreMCTS
(
new
Fraction
());
// Attention ! Ce constructeur initialise donc avec des valeurs nulles en racine !
fils
.
add
(
Arbre_i
);
fils
.
add
(
Arbre_i
);
}
}
}
}
public
Arbre
(
Fraction
value
){
public
Arbre
MCTS
(
Fraction
value
){
this
.
value
=
value
;
this
.
value
=
value
;
}
}
public
Arbre
(
int
num
,
int
den
){
public
ArbreMCTS
(
int
den
,
int
num
){
this
.
value
.
den
=
den
;
this
.
value
.
den
=
den
;
this
.
value
.
num
=
num
;
this
.
value
.
num
=
num
;
}
}
// Les accesseurs :
// Les accesseurs :
public
Fraction
getFraction
(){
return
value
;
}
public
double
getvalue
(){
public
double
getvalue
(){
return
(
value
.
getNote
());
return
(
value
.
getNote
());
}
}
public
ArrayList
<
Arbre
>
getfils
(){
public
ArrayList
<
Arbre
MCTS
>
getfils
(){
return
(
fils
);
return
(
fils
);
}
}
public
ArrayList
getcoups
(){
public
ArrayList
<
Coup
>
getcoups
(){
return
(
coups
);
return
(
coups
);
}
}
...
@@ -101,10 +103,10 @@ public class Arbre {
...
@@ -101,10 +103,10 @@ public class Arbre {
}
}
else
{
else
{
int
a
=
this
.
fils
.
size
();
int
a
=
this
.
fils
.
size
();
Arbre
fils0
=
this
.
fils
.
get
(
0
);
Arbre
MCTS
fils0
=
this
.
fils
.
get
(
0
);
int
maxfils
=
fils0
.
hauteur
();
int
maxfils
=
fils0
.
hauteur
();
for
(
int
i
=
1
;
i
<
a
;
i
++){
for
(
int
i
=
1
;
i
<
a
;
i
++){
Arbre
next
=
this
.
fils
.
get
(
i
);
Arbre
MCTS
next
=
this
.
fils
.
get
(
i
);
maxfils
=
Math
.
max
(
next
.
hauteur
(),
maxfils
);
maxfils
=
Math
.
max
(
next
.
hauteur
(),
maxfils
);
}
}
return
(
1
+
maxfils
);
return
(
1
+
maxfils
);
...
...
src/tictactoecodingame/Selection.java
0 → 100644
View file @
87948af0
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
tictactoecodingame
;
import
java.util.ArrayList
;
/**
*
* @author louis
*/
public
class
Selection
{
ArrayList
<
Integer
>
chemin
;
public
Selection
(){
chemin
=
new
ArrayList
<>();
}
public
Selection
(
double
c
,
ArbreMCTS
a
){
Selection
s
=
new
Selection
();
chemin
=
SelectionAux
(
c
,
a
,
s
,
0
).
chemin
;
}
private
Selection
SelectionAux
(
double
c
,
ArbreMCTS
a
,
Selection
s
,
int
nbSimulPere
){
if
(
a
.
estFeuille
()){
return
s
;
}
else
{
double
coefMax
=
0
;
int
indiceSelection
=
0
;
ArrayList
<
ArbreMCTS
>
f
=
a
.
getfils
();
for
(
int
i
=
0
;
i
<
f
.
size
();
i
++){
ArbreMCTS
arbreTeste
=
f
.
get
(
i
);
double
coef
=
arbreTeste
.
getvalue
()+
c
*
Math
.
sqrt
(
Math
.
log
(
nbSimulPere
)/
arbreTeste
.
getFraction
().
getDenominateur
());
if
(
coef
>
coefMax
){
indiceSelection
=
i
;
coefMax
=
coef
;
}
}
ArbreMCTS
arbreSelectionne
=
f
.
get
(
indiceSelection
);
int
nbSimulPereNew
=
arbreSelectionne
.
getFraction
().
getDenominateur
();
s
.
chemin
.
add
(
indiceSelection
);
return
SelectionAux
(
c
,
arbreSelectionne
,
s
,
nbSimulPereNew
);
}
}
}
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