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
c9752263
Commit
c9752263
authored
Apr 21, 2020
by
DELBECQ Théo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'Theo'
Master See merge request
!5
parents
875db1ea
ce4cc8dd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
344 additions
and
23 deletions
+344
-23
Player.class
build/classes/tictactoecodingame/Player.class
+0
-0
private.xml
nbproject/private/private.xml
+0
-22
AlgoRecherMinMax1.java
src/tictactoecodingame/AlgoRecherMinMax1.java
+29
-0
Arbre.java
src/tictactoecodingame/Arbre.java
+105
-0
ArbreMinMax.java
src/tictactoecodingame/ArbreMinMax.java
+151
-0
Fraction.java
src/tictactoecodingame/Fraction.java
+58
-0
Player.java
src/tictactoecodingame/Player.java
+1
-1
No files found.
build/classes/tictactoecodingame/Player.class
deleted
100644 → 0
View file @
875db1ea
File deleted
nbproject/private/private.xml
deleted
100644 → 0
View file @
875db1ea
<?xml version="1.0" encoding="UTF-8"?>
<project-private
xmlns=
"http://www.netbeans.org/ns/project-private/1"
>
<editor-bookmarks
xmlns=
"http://www.netbeans.org/ns/editor-bookmarks/2"
lastBookmarkId=
"0"
/>
<open-files
xmlns=
"http://www.netbeans.org/ns/projectui-open-files/2"
>
<group>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/JoueurHumain.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/CoupTicTacToe9x9.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Piece.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/AlgoRecherche.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Jeton.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Player.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Plateau.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Arbitre.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/AlgoRechercheAleatoire.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Coup.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/JoueurOrdi.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Joueur.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/Case.java
</file>
<file>
file:/C:/Users/franck.tempet/Documents/NetBeansProjects/TicTacToeCodingame/src/tictactoecodingame/GrilleTicTacToe9x9.java
</file>
</group>
</open-files>
</project-private>
src/tictactoecodingame/AlgoRecherMinMax1.java
0 → 100644
View file @
c9752263
/*
* 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 senda
*/
public
class
AlgoRecherMinMax1
extends
AlgoRecherche
{
ArrayList
ListCoup
;
public
AlgoRecherMinMax1
()
{
}
@Override
public
Coup
meilleurCoup
(
Plateau
_plateau
,
Joueur
_joueur
,
boolean
_ponder
)
{
ListCoup
=
_plateau
.
getListeCoups
(
_joueur
);
return
;
}
}
src/tictactoecodingame/Arbre.java
0 → 100644
View file @
c9752263
/*
* 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 senda
*/
public
class
Arbre
{
private
Fraction
value
;
private
ArrayList
<
Coup
>
coups
;
private
ArrayList
<
Arbre
>
fils
;
// Les constructeurs :
public
Arbre
(
Fraction
value
,
ArrayList
coups
,
ArrayList
fils
){
this
.
value
=
value
;
this
.
fils
=
fils
;
this
.
coups
=
coups
;
}
public
Arbre
(
int
den
,
int
num
,
ArrayList
coups
,
ArrayList
fils
){
this
.
value
.
den
=
den
;
this
.
value
.
num
=
num
;
this
.
fils
=
fils
;
this
.
coups
=
coups
;
}
public
Arbre
(
Fraction
value
,
Plateau
_plateau
,
Joueur
_joueur
){
this
.
value
=
value
;
this
.
coups
=
_plateau
.
getListeCoups
(
_joueur
)
;
int
a
=
coups
.
size
();
fils
=
new
ArrayList
();
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 !
fils
.
add
(
Arbre_i
);
}
}
public
Arbre
(
Fraction
value
){
this
.
value
=
value
;
}
public
Arbre
(
int
den
,
int
num
){
this
.
value
.
den
=
den
;
this
.
value
.
num
=
num
;
}
// Les accesseurs :
public
double
getvalue
(){
return
(
value
.
getNote
());
}
public
ArrayList
getfils
(){
return
(
fils
);
}
public
ArrayList
getcoups
(){
return
(
coups
);
}
//Des choses sans nom :
public
void
setvalue
(
Fraction
value
){
this
.
value
=
value
;
}
public
void
setfils
(
ArrayList
fils
){
this
.
fils
=
fils
;
}
public
void
setcoups
(
ArrayList
coups
){
this
.
coups
=
coups
;
}
//Fonctions auxiliaires :
public
boolean
estFeuille
(){
return
(
fils
==
null
);
}
public
boolean
estNoeud
(){
return
(
fils
!=
null
);
}
public
int
hauteur
(){
if
(
this
.
estFeuille
()){
return
1
;
}
else
{
int
a
=
this
.
fils
.
size
();
Arbre
fils0
=
this
.
fils
.
get
(
0
);
int
maxfils
=
fils0
.
hauteur
();
for
(
int
i
=
1
;
i
<
a
;
i
++){
Arbre
next
=
this
.
fils
.
get
(
i
);
maxfils
=
Math
.
max
(
next
.
hauteur
(),
maxfils
);
}
return
(
1
+
maxfils
);
}
}
}
src/tictactoecodingame/ArbreMinMax.java
0 → 100644
View file @
c9752263
/*
* 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 senda
*/
public
class
ArbreMinMax
{
public
static
int
N
=
5
;
protected
int
value
;
protected
ArrayList
<
Coup
>
coups
;
protected
ArrayList
<
ArbreMinMax
>
fils
;
// Les constructeurs :
public
ArbreMinMax
(){
}
public
ArbreMinMax
(
int
value
,
ArrayList
coups
,
ArrayList
fils
){
this
.
value
=
value
;
this
.
fils
=
fils
;
this
.
coups
=
coups
;
}
public
ArbreMinMax
(
int
value
,
Plateau
_plateau
,
Joueur
_joueur
){
this
.
value
=
value
;
this
.
coups
=
_plateau
.
getListeCoups
(
_joueur
)
;
int
a
=
coups
.
size
();
fils
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
a
;
i
++){
ArbreMinMax
Arbre_i
=
new
ArbreMinMax
(
0
);
// Attention ! Ce constructeur initialise donc avec des valeurs nulles en racine !
fils
.
add
(
Arbre_i
);
}
}
public
ArbreMinMax
(
int
value
){
this
.
value
=
value
;
}
// Les accesseurs :
public
int
getvalue
(){
return
(
value
);
}
public
ArrayList
<
ArbreMinMax
>
getfils
(){
return
(
fils
);
}
public
ArrayList
getcoups
(){
return
(
coups
);
}
//Des choses sans nom :
public
void
setvalue
(
int
value
){
this
.
value
=
value
;
}
public
void
setfils
(
ArrayList
fils
){
this
.
fils
=
fils
;
}
public
void
setcoups
(
ArrayList
coups
){
this
.
coups
=
coups
;
}
//Fonctions auxiliaires :
public
boolean
estFeuille
(){
return
(
fils
==
null
);
}
public
boolean
estNoeud
(){
return
(
fils
!=
null
);
}
public
int
hauteur
(){
if
(
this
.
estFeuille
()){
return
1
;
}
else
{
int
a
=
this
.
fils
.
size
();
ArbreMinMax
fils0
=
this
.
fils
.
get
(
0
);
int
maxfils
=
fils0
.
hauteur
();
for
(
int
i
=
1
;
i
<
a
;
i
++){
ArbreMinMax
next
=
this
.
fils
.
get
(
i
);
maxfils
=
Math
.
max
(
next
.
hauteur
(),
maxfils
);
}
return
(
1
+
maxfils
);
}
}
public
int
Min
(){
int
m
=
2147483640
;
int
a
=
this
.
getfils
().
size
();
for
(
int
i
=
0
;
i
<
a
;
i
++){
int
n
=
this
.
getfils
().
get
(
i
).
getvalue
();
if
(
n
<
m
){
m
=
n
;
}
}
return
m
;
}
public
int
Max
(){
int
m
=
0
;
int
a
=
this
.
getfils
().
size
();
for
(
int
i
=
0
;
i
<
a
;
i
++){
int
n
=
this
.
getfils
().
get
(
i
).
getvalue
();
if
(
n
>
m
){
m
=
n
;
}
}
return
m
;
}
public
void
MinMax
(
int
h
){
// h = hauteur, on l'incrémente comme un compteur
// N est la profondeur à explorer en MinMax, toutes les feuilles en N+1 sont évaluées
// La racine est un Max, donc impair -> Max, pair -> Min
if
(
N
>=
h
){
// On doit chosir entre min et max
if
(
h
%
2
==
0
){
//On attribue le Min
int
m
=
this
.
Min
();
this
.
setvalue
(
m
);
}
else
{
//On attribue le max
int
m
=
this
.
Max
();
this
.
setvalue
(
m
);
}
int
a
=
this
.
getfils
().
size
();
for
(
int
i
=
0
;
i
<
a
;
i
++){
this
.
getfils
().
get
(
i
).
MinMax
(
h
+
1
);
}
}
else
{
//On a h > N, on utilise la fonction d'évaluation
}
}
}
src/tictactoecodingame/Fraction.java
0 → 100644
View file @
c9752263
/*
* 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
;
/**
*
* @author senda
*/
public
class
Fraction
{
int
num
;
int
den
;
public
Fraction
(
int
n
,
int
d
){
num
=
n
;
den
=
d
;
}
public
Fraction
(){
num
=
0
;
den
=
0
;
}
public
Fraction
(
int
n
){
num
=
n
;
den
=
1
;
}
public
int
getScore
(){
return
num
;
}
public
double
getNote
(){
try
{
return
num
/
den
;
}
catch
(
ArithmeticException
e
){
return
1
.;}
}
public
int
getNumerateur
(){
return
num
;
}
public
int
getDenominateur
(){
return
den
;}
public
void
setDenominateur
(
int
d
){
den
=
d
;}
public
void
setNumerateur
(
int
n
){
num
=
n
;
}
public
void
incrementeNumerateur
(){
num
+=
1
;}
public
void
incrementeDenominateur
(){
den
+=
1
;}
}
src/tictactoecodingame/Player.java
View file @
c9752263
...
...
@@ -26,7 +26,7 @@ public class Player {
Arbitre
a
=
new
Arbitre
(
grille
,
joueurOrdi
,
joueurOrdi
);
Arbitre
a
=
new
Arbitre
(
grille
,
joueurOrdi
,
humain
);
//
Arbitre a = new Arbitre(grille, joueurOrdi , humain );
a
.
startNewGame
(
true
);
// Demarre une partie en affichant la grille du jeu
...
...
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