From 8b8ff56069dac7e153f20ef78a49254553332d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kayyissa=20HA=C3=8FSSOUS?= Date: Sat, 8 Apr 2023 10:19:51 +0200 Subject: [PATCH] fix des pions blancs --- .../java/com/example/mastermind/game/Bot.java | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/example/mastermind/game/Bot.java b/app/src/main/java/com/example/mastermind/game/Bot.java index 9352c10..d21f664 100644 --- a/app/src/main/java/com/example/mastermind/game/Bot.java +++ b/app/src/main/java/com/example/mastermind/game/Bot.java @@ -43,50 +43,31 @@ public class Bot { for(int i=0; i<4;i++) { if (copyCombi[i]==soumission[i]) { note.add(this.pionsNotation[1]); - copyCombi[i]=-1; + copyCombi[i]=null; System.out.println(note.getLast()+" good "+i); } } //blancs for(int i=0; i<4;i++) { - if(copyCombi[i]!=-1){ + if(copyCombi[i]!=null){ for (int y=0;y<4;y++){ if (soumission[y]==copyCombi[i]) { note.add(this.pionsNotation[0]); System.out.println(note.getLast() + " almost "+i); - copyCombi[i] = -1; + copyCombi[i] = null; } } } } - - /* Integer[] copyCombi = new Integer[4]; - System.arraycopy(this.collectionWin, 0, copyCombi, 0,4); - for(int i=0; i<4;i++) { - for(int y=0;y<4;y++){ - if(i==y&&soumission[i]==copyCombi[y]){ - note.add(this.pionsNotation[1]); - System.out.println(note.getLast()+" good"); - copyCombi[y]=-1; - break; - } else if (soumission[i]==copyCombi[y]){ - note.add(this.pionsNotation[0]); - System.out.println(note.getLast()+" almost"); - copyCombi[y]=-1; - break; - } - } - }*/ - // On complĂȘte avec des cases vides while (note.size()<4){ note.addLast(this.pionVide); } Integer[] tabnote = new Integer[4]; - //fill tab TODO: and shuffle + //fill tab Random rand = new Random(); for(int i=0; i<4;i++) { tabnote[i]=note.get(i);