202 lines
3.7 KiB
Markdown
202 lines
3.7 KiB
Markdown
# BUT3 Jeu
|
|
|
|
##### Groupe : Dylan LANDRIN, Killian SCHIED
|
|
|
|
## Séance du 12/09/24
|
|
Au cours de cette séance, nous avons implémenté 3 algorithmes en python:
|
|
|
|
### exploreMax
|
|
Le but d'explore max est de déterminer si le joueur 1 peux faire un coup qui mettrais en echec joueur 2.
|
|
|
|
### exploreMin
|
|
Le but de Min est l'inverse, il voit s'il peut mettre joueur 1 en échec
|
|
|
|
### miniMax
|
|
miniMax appelle les explorations
|
|
|
|
## Séance du 17/09/24
|
|
Au cours de cette séance, nous avons apportés des modifications dans les fonctions utilisées dans l'algorithme miniMax() ainsi qu'un affichage de l'objet Game.
|
|
|
|
### exploreMax() et exploreMin()
|
|
Des optimisations ont été apportés dans ces fonctions afin de stopper la recherche lorsque une solution a été trouvée.
|
|
|
|
Exemple :
|
|
#### Avant
|
|
Test avec 5 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 5
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 17
|
|
exploreMin calls = 19
|
|
First player winning ? = False
|
|
```
|
|
|
|
Test avec 11 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 11
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 261
|
|
exploreMin calls = 261
|
|
First player winning ? = True
|
|
```
|
|
|
|
Test avec 14 allumettes :
|
|
|
|
```
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 14
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 916
|
|
exploreMin calls = 913
|
|
First player winning ? = True
|
|
```
|
|
|
|
Test avec 17 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 17
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 6401
|
|
exploreMin calls = 6403
|
|
First player winning ? = False
|
|
```
|
|
|
|
Test avec 42 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
```
|
|
|
|
Test avec 100 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
```
|
|
|
|
#### Après
|
|
Test avec 5 allumettes :
|
|
```
|
|
$ python3 game_optimized.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 5
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 3
|
|
exploreMin calls = 3
|
|
First player winning ? = False
|
|
```
|
|
|
|
Test avec 11 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 11
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 6
|
|
exploreMin calls = 6
|
|
First player winning ? = True
|
|
```
|
|
|
|
Test avec 14 allumettes :
|
|
|
|
```
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 14
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 8
|
|
exploreMin calls = 7
|
|
First player winning ? = True
|
|
```
|
|
|
|
Test avec 17 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 17
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 9
|
|
exploreMin calls = 9
|
|
First player winning ? = False
|
|
```
|
|
|
|
Test avec 42 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 42
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 22
|
|
exploreMin calls = 21
|
|
First player winning ? = True
|
|
```
|
|
|
|
Test avec 100 allumettes :
|
|
```
|
|
$ python3 game.py
|
|
|
|
-----------------------
|
|
Game and algorithm data
|
|
-----------------------
|
|
== Game data ==
|
|
Remaining matches : 100
|
|
Game state : 0
|
|
Actual player : 1
|
|
== Algorithm data ==
|
|
exploreMax calls = 51
|
|
exploreMin calls = 50
|
|
First player winning ? = True
|
|
``` |