From 37d9f8da73d86577cdf1dace4a16ce6bea69d8b2 Mon Sep 17 00:00:00 2001 From: MaurizioBruetsch <32775189+MaurizioBruetsch@users.noreply.github.com> Date: Wed, 25 Oct 2017 15:20:13 +0200 Subject: [PATCH] AI sees two move loosing tricks --- src/player/maurizio/MaurizioAI.java | 40 ++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/player/maurizio/MaurizioAI.java b/src/player/maurizio/MaurizioAI.java index b437474..7ccb57f 100644 --- a/src/player/maurizio/MaurizioAI.java +++ b/src/player/maurizio/MaurizioAI.java @@ -82,11 +82,43 @@ public class MaurizioAI implements Player { } } - //no 2-move winning moves, then choose a non-loosing move - if(moves1.isEmpty()){ + //copy moves + LinkedList moves2 = new LinkedList(); + for(int i : moves1){ + moves2.add(i); + } + // avoid 2-move losses + for(int i : moves1){ // I make a move + int[][] board1 = makeMove(board, i, id); + for(int j=0;j