mirror of
https://github.com/Cpt-Adok/SNAKE.git
synced 2026-03-31 10:21:35 +00:00
Ia (#4)
* correction de probleme et ajout d'un quick multi * correction de probleme * changer le main * programme fini~ pour l'ia * correction de probleme * Robot (#3) * Robot qui marche pas encore * Robot teubé mais marche bien, marche très bien en local mais problème en réseau * Robot fini mais problème en réseau * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: Cpt-Adok <theo.faria@laposte.net> Co-authored-by: Cpt-Adok <126670243+Cpt-Adok@users.noreply.github.com> * correction de probleme et ajout de learn.ser --------- Co-authored-by: Cpt-Adok <theo.faria@laposte.net> Co-authored-by: Cpt-Adok <126670243+Cpt-Adok@users.noreply.github.com>
This commit is contained in:
@@ -1,24 +1,46 @@
|
||||
import connexion.Channel;
|
||||
import connexion.Reseau;
|
||||
import java.io.File;
|
||||
|
||||
import IA.QTable;
|
||||
import environnements.*;
|
||||
import game.Terminal;
|
||||
import personnages.*;
|
||||
import types.Item;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Personnage.n = 2;
|
||||
Personnage.n = 4;
|
||||
|
||||
Map map = new Map(20, 20);
|
||||
Map map = new Map(12, 22);
|
||||
|
||||
Personnage[] personnages = new Personnage[] {
|
||||
new Player(new int[] {0, 0}, "Philippe Etchebest"),
|
||||
};
|
||||
// lancer en local
|
||||
if (args.length < 2) {
|
||||
Grid[][] grid = map.getGrid();
|
||||
|
||||
|
||||
// map.addObjects(Item.FRAISE, 0, 0);
|
||||
// map.addObjectsRandomize(new Item[] {Item.FRAISE}, 1);
|
||||
QTable qTable = new QTable();
|
||||
qTable.getValues("res" + File.separator + "save" + File.separator + "learn.ser");
|
||||
|
||||
new Terminal(map, personnages).run("channel129", "channel128");
|
||||
// Avant de jouer contre l'ia, vous pouvez essayer de l'entrainer avec la fonction tests.IATest.learnIAvsIA()
|
||||
// il jouera avec lui meme et mettra les sauvegardes dans le dossier learn.ser,
|
||||
|
||||
// Attention lors de l'apprentissage, ne pas couper le processus sinon vous allez perdre toute vos donnees
|
||||
Personnage[] personnages = new Personnage[] {
|
||||
new Player(new int[] {2, 2}, "Philippe Etchebest"),
|
||||
new Player(new int[] {grid[0].length - 3, grid.length - 3}, "Luke Skywalker"),
|
||||
// new Robot("Robot", new int[] {grid[0].length - 3, grid.length - 3}),
|
||||
// new IAQLearning(new int[] {grid[0].length - 3, grid.length - 3),
|
||||
};
|
||||
|
||||
// map.addObjectsRandomize(new Item[] {Item.FRAISE, Item.WALL}, 2);
|
||||
// map.addObjects(Item.FRAISE, 2, 2);
|
||||
|
||||
new Terminal(map, personnages).run();
|
||||
}
|
||||
// lancer en ligne
|
||||
else {
|
||||
Personnage[] personnages = new Personnage[] {
|
||||
new Player(new int[] {0, 0}, "Philippe Etchebest"),
|
||||
};
|
||||
|
||||
new Terminal(map, personnages).run(args[0], args[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user