From fa8ce856f10760e8a85518be7b75202bc0abd570 Mon Sep 17 00:00:00 2001 From: MaurizioBruetsch <32775189+MaurizioBruetsch@users.noreply.github.com> Date: Sun, 22 Oct 2017 18:17:49 +0200 Subject: [PATCH] AI enhancement --- src/player/maurizio/MaurizioAI.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/player/maurizio/MaurizioAI.java b/src/player/maurizio/MaurizioAI.java index 29c4e3f..52a58da 100644 --- a/src/player/maurizio/MaurizioAI.java +++ b/src/player/maurizio/MaurizioAI.java @@ -66,13 +66,13 @@ public class MaurizioAI implements Player { return moves1.peek(); } + //copy moves that do not loose LinkedList moves2 = new LinkedList(); for(int i : moves1){ moves2.add(i); } - //find the best of the non losing move - //look for two move wins + //look for two move wins among the non-loosing moves LinkedList removes = new LinkedList(); for(int i : moves2){ int[][] boardNew = makeMove(board, i, id); @@ -83,6 +83,7 @@ public class MaurizioAI implements Player { int[][] boardNewNew = makeMove(boardNew, j, enemyID); for(int k=0;k=0 && x < Game.GAME_COLUMNS) && (y>=0 && y < Game.GAME_ROWS)); } /** - * checks whether the last Move closed any lines on the board + * checks whether the last move closed any lines on the board */ private boolean checkWin(int[][] board, int col, int iD){ // find row of last move -- assuming the move was legal