From ece9929f4f0e7b0738cf515f3730f42d9f760236 Mon Sep 17 00:00:00 2001 From: chaignea Date: Sat, 8 Apr 2023 18:22:26 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20bug=20>=20Validation=20d'une=20pro?= =?UTF-8?q?position=20avec=20une=20pi=C3=A8ce=20vide=20possible=20alors=20?= =?UTF-8?q?que=20non=20autoris=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../7.5/executionHistory/executionHistory.bin | Bin 1182076 -> 1182076 bytes .../executionHistory/executionHistory.lock | Bin 17 -> 17 bytes .gradle/7.5/fileHashes/fileHashes.bin | Bin 73565 -> 73565 bytes .gradle/7.5/fileHashes/fileHashes.lock | Bin 17 -> 17 bytes .../7.5/fileHashes/resourceHashesCache.bin | Bin 20843 -> 20911 bytes .../buildOutputCleanup.lock | Bin 17 -> 17 bytes .../mastermind/MasterMindActivity.java | 79 +++++++++++------- 7 files changed, 47 insertions(+), 32 deletions(-) diff --git a/.gradle/7.5/executionHistory/executionHistory.bin b/.gradle/7.5/executionHistory/executionHistory.bin index 5bc1eb29fbd598b834ab26a8a398d2bfabba585e..2ec63321d98709cd7193ac559064d21a9c8d64af 100644 GIT binary patch delta 1010 zcmew}$>Yx?j|~n*N=7MZ*+wQwW~rvhRe4#)h1rRw1sMfpB_*W{V8HQlyS*}RC)4KF zCCLIp4XiV|3Ul`X-PxR!{+T7LJ#wKv(;StZr?o6p3kK`vWeevYX zW`&**CS7U6?1=lUSEqS2eK-{+V`sej&x+n}25)*_F*7p=v`Z=KWz66i|*4qtJ`IH&AJKx|_V;20^edWrzgVNu%ZKG1|Y`PwPda`1V=JtRhUJl0T zul%?KSQ=ie=$-!0kLwy&3y}5A;0HV7-06iMd1a>WzRNe8Wd}$)>K>o=^dkXW0TQhY zQODi3cb2Z}`Vl{AMjYEpu%3;k+jRoD%osgcxz{gDv*OOT*q(XN>S1szFaS=LCq%wj z#P{^(ypSUdi}zm!3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jzLMTx)>M`t@F38NO zu>BSj9|xx#dKzWyNzO?uE>11hOG&L@oG#eQqB2>aRAjPWpSU1Kn%$nj!xzoY^58Ns zDeM>K>k(mdRyw`==;WM-&hFm#jW^uwx&)Mo7vZZ>zT@J*;pRRky9}|(s_vN&lYqY1 z&T!0g%Tbd_51MWqe((5Bc=|sPz7(ksTbp-hwh2Ca`(Vb$Xup6P_kf0fGibhZnrZq& zKTe71tA+Ulq(L?Ua}pEKl#fi|m)>T)C~wu!@UuB>a;bg4C?62>1F^vN{i1?SXEWqo5>$z zgr{4GGrBRavQL`cD9$J)F*D|9dB&S_t0h#8C7k6Hze2T4oxWL|u}&dB?zF3n)^Cl) lD>d(DM|;UbWbG5d1_r(Ty**HZv7QMSEG*kEOEGq_000YLZbkqA delta 322 zcmcb+kLB(@mJO?yDlFrW*zn$eT6jm<4!JiIx*Qo87~2zPaeZU}1No<$PcIE-WS%A4 zJXvx1QSMo?yCD+ng_9=+3(IHxPMdgoi{agU?{(tYPjx{w%Wj6Kkz${`u|s&W*^1)| z-_6RzA6CEqP@v;rP~gy#3sv|PqA>Z=^oeqeYMY%`K44Tx687Hq>2>7O{l>RK);e7| z22m=v5TaCU!e-~yhq4t))vsTkUi(l^&g}H$H*8fv8$r(2m8V56BL*-C%$_VN{Xl^Asadub`<7==!QRbp zrB5?4?%b&OLwut_g5YLH4=qj?W1y@g5DS8^!0cb~Oj#3}A71+?|LgdjP$rP W4D%J5@}K=NJMzQrlKL%ckO}}+axFUm delta 40 ycmV+@0N4MoqXFxp0kAX}0Y$Sl80Z3%H5=HoB^<*70g168_!qG-kP)*%NGb_H*bd$R diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index be4ad6f7b33d410eef4908ab2b84307cab2f5711..3cb8c5326fb349f4c0d44884ad68ef76d6af884a 100644 GIT binary patch literal 17 VcmZP$F`c)6-~Z@+3}C<=1OPdA1swnY literal 17 VcmZP$F`c)6-~Z@+3}C=*1^_u*1pxp6 diff --git a/app/src/main/java/com/example/mastermind/MasterMindActivity.java b/app/src/main/java/com/example/mastermind/MasterMindActivity.java index aee1e2d..3d5b051 100644 --- a/app/src/main/java/com/example/mastermind/MasterMindActivity.java +++ b/app/src/main/java/com/example/mastermind/MasterMindActivity.java @@ -76,43 +76,58 @@ public class MasterMindActivity extends AppCompatActivity { } public void nextTurn(){ - if(this.tour<9){ - //on affiche la correction - boolean gagne = this.afficherCorrection((LinearLayout) this.jeu.getChildAt(this.tour)); - //on supprime les listener et sauvegarde la combinaison + boolean nextable = true; + if (!vide){ LinearLayout anciennesPieces =(LinearLayout) this.jeu.getChildAt(this.tour); - - ArrayList combinaison = new ArrayList<>(); for(int i=0; i0){ - LinearLayout anciennesPieces =(LinearLayout) this.jeu.getChildAt(this.tour-1); - - for(int i=0; i combinaison = new ArrayList<>(); + for (int i = 0; i < anciennesPieces.getChildCount(); i++) { + anciennesPieces.getChildAt(i).setOnTouchListener(null); + combinaison.add(((UnePiece) anciennesPieces.getChildAt(i)).getColor()); + } + this.combinaisons.add(combinaison); + + if (gagne) { + this.finDePartie(true); + } else { + //on incremente le tour + this.tour++; + //on récupere le LinearLayout des pieces du tour + LinearLayout pieces = (LinearLayout) this.jeu.getChildAt(this.tour); + //on ajoute le listener + for (int i = 0; i < pieces.getChildCount(); i++) { + UnePiece p = (UnePiece) pieces.getChildAt(i); + p.setOnTouchListener(new MonOnTouchListener(p, this.vide)); + } + } + + } else { + //on affiche la correction + boolean gagne = this.afficherCorrection((LinearLayout) this.jeu.getChildAt(this.tour)); + //on supprime les listener + if (this.tour > 0) { + LinearLayout anciennesPieces = (LinearLayout) this.jeu.getChildAt(this.tour - 1); + + for (int i = 0; i < anciennesPieces.getChildCount(); i++) { + anciennesPieces.getChildAt(i).setOnTouchListener(null); + } + } + this.finDePartie(gagne); } - this.finDePartie(gagne); } }