legitbugfix #19
@@ -0,0 +1,7 @@
|
||||
Bot 1, Bot 2, Winner
|
||||
RandomBot,MiniMaxBot,WIN
|
||||
RandomBot,HeuristicBot,WIN
|
||||
RandomBot,MonteCarloBot,WIN
|
||||
MiniMaxBot,HeuristicBot,WIN
|
||||
MiniMaxBot,MonteCarloBot,WIN
|
||||
HeuristicBot,MonteCarloBot,WIN
|
||||
|
||||
|
@@ -12,11 +12,13 @@ public class Arena {
|
||||
|
||||
private List<AbstractGamePlayer> bots = new ArrayList<>();
|
||||
private FileWriter csvWriter;
|
||||
private int board_size;
|
||||
|
||||
public Arena() {
|
||||
public Arena(int size) {
|
||||
try {
|
||||
csvWriter = new FileWriter("arena_results.csv");
|
||||
csvWriter.append("Bot 1, Bot 2, Winner\n");
|
||||
this.board_size = size;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -51,7 +53,7 @@ public class Arena {
|
||||
}
|
||||
|
||||
private Result playMatch(AbstractGamePlayer bot1, AbstractGamePlayer bot2) {
|
||||
IBoard board = new HexBoard(11);
|
||||
IBoard board = new HexBoard(this.board_size);
|
||||
EnumMap<Player, AbstractGamePlayer> players = new EnumMap<>(Player.class);
|
||||
players.put(Player.PLAYER1, bot1);
|
||||
players.put(Player.PLAYER2, bot2);
|
||||
|
||||
@@ -4,7 +4,11 @@ import fr.iut_fbleau.GameAPI.Player;
|
||||
|
||||
public class ArenaMain {
|
||||
public static void main(String[] args) {
|
||||
Arena arena = new Arena();
|
||||
int size = 7;
|
||||
if (args.length >= 1) {
|
||||
try { size = Integer.parseInt(args[0]); } catch (NumberFormatException ignored) {}
|
||||
}
|
||||
Arena arena = new Arena(size);
|
||||
arena.addBot(new RandomBot(Player.PLAYER1, 12345L)); // Correct constructor usage
|
||||
arena.addBot(new MiniMaxBot(Player.PLAYER2));
|
||||
arena.addBot(new HeuristicBot(Player.PLAYER1));
|
||||
|
||||
Reference in New Issue
Block a user