35 lines
979 B
Java
35 lines
979 B
Java
package fr.iut_fbleau.HexGame;
|
|
|
|
import fr.iut_fbleau.GameAPI.*;
|
|
|
|
import java.util.EnumMap;
|
|
import java.util.Scanner;
|
|
|
|
/**
|
|
* Lancement d'une partie de Hex en console.
|
|
*/
|
|
public class HexMain {
|
|
|
|
public static void main(String[] args) {
|
|
int size = 7;
|
|
if (args.length >= 1) {
|
|
try { size = Integer.parseInt(args[0]); } catch (NumberFormatException ignored) {}
|
|
}
|
|
|
|
HexBoard board = new HexBoard(size);
|
|
|
|
Scanner sc = new Scanner(System.in);
|
|
EnumMap<Player, AbstractGamePlayer> players = new EnumMap<>(Player.class);
|
|
players.put(Player.PLAYER1, new HumanConsolePlayer(Player.PLAYER1, sc));
|
|
players.put(Player.PLAYER2, new HumanConsolePlayer(Player.PLAYER2, sc));
|
|
|
|
AbstractGame game = new AbstractGame(board, players) {};
|
|
Result res = game.run();
|
|
|
|
System.out.println(board);
|
|
System.out.println("Résultat (du point de vue de PLAYER1) : " + res);
|
|
|
|
sc.close();
|
|
}
|
|
}
|