From e87e25236088b4ab76c61f435866100146a73171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kayyissa=20HA=C3=8FSSOUS?= Date: Sun, 9 Apr 2023 17:20:06 +0200 Subject: [PATCH] correction algo notation (encore) --- app/src/main/java/com/example/mastermind/GameActivity.java | 3 ++- app/src/main/java/com/example/mastermind/game/Bot.java | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/example/mastermind/GameActivity.java b/app/src/main/java/com/example/mastermind/GameActivity.java index 4bdabc0..b6de6c4 100644 --- a/app/src/main/java/com/example/mastermind/GameActivity.java +++ b/app/src/main/java/com/example/mastermind/GameActivity.java @@ -154,12 +154,13 @@ public class GameActivity extends Activity implements SaisieActivity { textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); textView.setGravity(Gravity.CENTER); if (gagne){ - textView.setText("Victoire de l'attaquand en test coups"); + textView.setText("Victoire de l'attaquant en "+this.grille.getSizeSubs()+" coups"); } else { textView.setText("Victoire du défenseur"); } this.rootView.addView(textView); System.out.println(textView.getText()); + this.rootView.invalidate(); } //initialise les collections de pions et remplie saisie et grille de pions vides 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 38e9dff..184f0dc 100644 --- a/app/src/main/java/com/example/mastermind/game/Bot.java +++ b/app/src/main/java/com/example/mastermind/game/Bot.java @@ -43,8 +43,10 @@ public class Bot { for(int i=0; i<4;i++) { if (copyCombi[i]==soumission[i]) { note.add(this.pionsNotation[1]); + System.out.println(copyCombi[i]+" good "+i); copyCombi[i]=null; - System.out.println(note.getLast()+" good "+i); + soumission[i]=null; + System.out.println(copyCombi[i]+" good "+i); } } @@ -54,8 +56,9 @@ public class Bot { for (int y=0;y<4;y++){ if (soumission[y]==copyCombi[i]) { note.add(this.pionsNotation[0]); - System.out.println(note.getLast() + " almost "+i); + System.out.println(copyCombi[i] + " almost "+i+" "+y); copyCombi[i] = null; + System.out.println(copyCombi[i] + " almost "+i+" "+y); } } }