From c49a63f843b0fc5ce2473993428d4b64f9a2c950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Sun, 21 Nov 2021 15:44:55 +0100 Subject: [PATCH] master --- bin/lab6/HangMan.class | Bin 2585 -> 3249 bytes bin/lab6/WordManager.class | Bin 4998 -> 4996 bytes src/lab6/HangMan.java | 20 ++++++++++++++++++-- src/lab6/WordManager.java | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/lab6/HangMan.class b/bin/lab6/HangMan.class index da6a604a96654eec7ed92c6692bc4c4a87e69109..4239f8381a703a4100997332f075f11a40383fb4 100644 GIT binary patch literal 3249 zcmZ`*T~u6G75>i5By*Wul3@ab6fifoX@&`9Qb?l~+87`K3=|AVfYc_J;mTYXX2v^r zAk?bWMC(uesXx)AYFZP;w(+Mi4A`vYa{1uO(l?*GT+0WaeDT4hFR}64_YNru35zrL zo_+S&XP<9>d++<__ulzEfDhqD7y$)6V@@7S_L|x00W%v$NFh37&YQ^$CCS0b87t)~ zR16#*J2gCVWN27H^(j<#<+26W%(|myrf3CePE*)aNSPULB4$%X$FZ{Rse)_e6}H&f ze9`T`?bZo(94F*x^lN(r5M#j6ulZI%1P=}664UZ^ri^8KiwxUwr;ySjWGK>Uw-s^G% zO{f#4$8`~%BQ`Ikejv(3R``E%X}bkp?t<%^kAFNK>T(NWh}E`8H}yv z7^ac67Rr!B@KJPzad?eW-L{#@O&4@@p_@0Dw%o3?$>`U_H~QSv6~bCJugzF<5WjCvbby#uFnrf@cKD!3TIWDjFZxaU3N5 zW;36+vLs+bylbPevX|`|KEeDjWaA0hIK~jK_omGC2OE%`6FN@fSq06_`T7dg@r_&B z1(WA=oWg0km$9JUJCETcOEojIwpu;)GS!^~Ib44R<&Ra$%S8$E? zxS0O54oA=riHzkVZ#piSrY1O299=w>QMISmPOThv&D89GnfE9wsqnmx&&ctcQY59L z;j<)y)CNP+vk9Nq@ggb-WwBs6BCo&~aW0IrFK8Xc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RA=jQ1xma1WF28ZV5l(S-7`cw6iU&0YAegU&s;TK@lg=RaIc&xCYJQZw zr%s^77klQ!eiqOJaOqif-5^sB5t%7Vu T=r2UV5D6{Dm+z1jz`K6~8yqRg diff --git a/bin/lab6/WordManager.class b/bin/lab6/WordManager.class index 69d0b66fe047956a269ca40e3a082665660b4128..f83518651e5d2a9bbd2a7fcbf5f195b918f28a88 100644 GIT binary patch delta 16 XcmZouZ&Bayj+t4Mi)-^|=E?j3Fj56^ delta 18 ZcmZosZ&Tm!j+s@QOMy#a^GD{%`~Wy|1+xGE diff --git a/src/lab6/HangMan.java b/src/lab6/HangMan.java index 8b09f74..bab4747 100644 --- a/src/lab6/HangMan.java +++ b/src/lab6/HangMan.java @@ -1,11 +1,16 @@ package lab6; +import java.awt.Color; + import hevs.graphics.FunGraphics; public class HangMan { final int MAX_STEPS = 8; final int scale = 2; int current_step = 0; + String inputLetter = "Inputed letter: "; + String inputLetter1 = ""; + String inputLetter2 = ""; WordManager word = new WordManager(); FunGraphics man = new FunGraphics(300 * scale, 300 * scale, 0, 0, "Hangman", true); @@ -14,6 +19,15 @@ public class HangMan { // System.out.print("Please enter a new letter: "); // char c = Input.readChar(); char c = Dialogs.getChar("Please enter a new letter"); + inputLetter += c + " "; + + if (inputLetter.length()<=50) { + inputLetter1 = inputLetter.substring(0, inputLetter.length()); + } else { + inputLetter1 = inputLetter.substring(0, 50); + inputLetter2 = " " + inputLetter.substring(51, inputLetter.length()); + } + boolean validLetter = word.checkLetter(c); if (!validLetter) { current_step++; @@ -31,7 +45,9 @@ public class HangMan { void updateGraphicsView() { man.clear(); - man.drawString(20 * scale, 60 * scale, "Word : " + word.userWord); + man.drawString(20 * scale, 60 * scale, "Word : " + word.userWord, Color.DARK_GRAY, 20*scale); + man.drawString(20*scale, 260*scale, inputLetter1, Color.DARK_GRAY, 10*scale); + man.drawString(20*scale, 270*scale, inputLetter2, Color.DARK_GRAY, 10*scale); for (int i = 1; i <= current_step; i++) { switch (i) { // dessin du pendu case 1: @@ -86,7 +102,7 @@ public class HangMan { } // System.out.print ("Do you want play another party ? (y/n) "); // char answer = Input.readChar(); - char answer = Dialogs.getChar("Do you want play another party ? (y/n) "); + char answer = Dialogs.getChar("Do you want to play another party ? (y/n) "); if (answer != 'y' && answer != 'Y') { // System.out.println("Ok, see you later."); Dialogs.displayMessage("Ok, see you later."); diff --git a/src/lab6/WordManager.java b/src/lab6/WordManager.java index 2f7d24f..4f913b6 100644 --- a/src/lab6/WordManager.java +++ b/src/lab6/WordManager.java @@ -47,7 +47,7 @@ public class WordManager { void lost(String msg){ String s = msg; - s += "\n \n The good word was: "; + s += "\n\nThe good word was: "; s += secretWord; Dialogs.displayMessage(s); }