From aeadd52815d702439bf9a3485ac1cdc34efae4a8 Mon Sep 17 00:00:00 2001 From: Fionn Date: Wed, 2 Feb 2022 11:13:36 +0100 Subject: [PATCH] bugfix, add message after game is done --- .../.vs/Lernprogramm3_Matchinggame/v17/.suo | Bin 35328 -> 31744 bytes .../Lernprogramm3_Matchinggame/Form1.cs | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Lernprogramm3_Matchinggame/.vs/Lernprogramm3_Matchinggame/v17/.suo b/Lernprogramm3_Matchinggame/.vs/Lernprogramm3_Matchinggame/v17/.suo index edccf3f2ff1f0cd64677b192686e6ddf00329d42..f6ed18d14262014612efa7acf33af20aa99ec3ce 100644 GIT binary patch delta 1366 zcmcgr-%C?*6u;lgU0v^X_3CDA>D1*alcjg&j}>H-4O=cyF$#LxC=p@Cbb}TZP4}{g zJ?K3V22wG4EW&#Ui6n%2s0h?QAnKt@ud(uEJ_`#sDzM{x9{YCJ%?nJ0NEE=S1`(2L~JGzTD1- zyIHty$?wkK?l^3SeIlvHZr`h9bkmaL;~3NxIWLB<*0;DL3KSTqGv)C0x>2aP;ch%Wtk{RTr1fh2K7g z>4XeR?p7(xP}c1aRy;>xZPEn~lag)HstPqjPrh5%Z>*|8Z#ppXrdInBej1rfOzCdj zUSROC7#$PL7~{lJFEbG)p82s5s@S-H>D}U8cjEb@Ync}pO7m(fNtuXqn6Fq!iWVX| zoox z!bQFlEek}#MM2F=B$61=MM8=IS(nAO=4a0Ci}`R_7-enxnox#rNwbK( zdC1E}6d>@k&HSyI>;ow_tu46TkH|qd5JiYg1f562iZ-TUav}T(P{kp344#YGtQh*m z?D5{Om`TRUw+~bKj*qMYt_Y`L&gx}tuqG_Z6oSg389HqTA)fBa*o%&AL>7f{?%Ue7 z;VdI65$T9RL@6?gFYG~!0`Nh3aJvj`o-6q%S2v;xQH?l+;M`WU>ktaUi>OB&Ml>Lr z@uaf+7PKgu59eY8|8irzb2VylFb6q^a1u99A;>0xlIbv?A;);9uE~C@(KNbL+)P#; zk;5|8$LmdA2RiAx&3`bhV_Jb9<^(VJT16Ns2pM*)MTGT&c9^#+5Gf4H9{h%`k)L2b zLJLR~hhSbnifhrzsHJp~oCA@P4w!Q`Lzl&_+bz<6Rus+gi@N_fV-Tps$S20Mynsy7 z;a=cgWPd z48(R-RbfMFq*m@U*Wf~cM0tmlmg0s;#gf4#)pIUHD#s>D1+6w9(&ORBL8LY;(+hE? zaP@dCR%AE&qcw~Ah&{xtOhQI^3d>9qmLX9Xl1c9L9JdcE>XJx@za8-+YzlT;5wP3N zkd={g=_PW8nKWk76XhYcbMCc*=EjVi&ARGVndS;gsZB^~fr9O%1q0;paUR8LI07Jqg2`|FiP2-Y=% z?}i(u>KqVjk)-LY?#1?@w@*;FO4Q?HyUm1HwGVtXebA@aU21%FX3&;+*t0PEz&HAG a^49I)n?Gmod>MT4>G5>#`x1RgQP?m296>Vx diff --git a/Lernprogramm3_Matchinggame/Lernprogramm3_Matchinggame/Form1.cs b/Lernprogramm3_Matchinggame/Lernprogramm3_Matchinggame/Form1.cs index 57a40b3..7884f0d 100644 --- a/Lernprogramm3_Matchinggame/Lernprogramm3_Matchinggame/Form1.cs +++ b/Lernprogramm3_Matchinggame/Lernprogramm3_Matchinggame/Form1.cs @@ -40,9 +40,11 @@ namespace Lernprogramm3_Matchinggame Control flipped2; int moves = 0; - + int foundCards = 0; + int cardsToFind; private void Form1_Load(object sender, EventArgs e) { + cardsToFind = icons.Count; foreach (Control con in tableLayoutPanel1.Controls) { int nextIndex = rdm.Next(icons.Count); @@ -84,6 +86,11 @@ namespace Lernprogramm3_Matchinggame } if (flipped2 == null) { + if (flipped1 == con) + { + MessageBox.Show("Nicht schummeln!", "Mogelpott"); + return; + } flipped2 = con; flipped2.Text = controlIcons[flipped2].Icon; @@ -98,6 +105,13 @@ namespace Lernprogramm3_Matchinggame } flipped1 = null; flipped2 = null; + + foundCards += 2; + + if (foundCards >= cardsToFind) + { + MessageBox.Show(string.Format("Herzlichen Glühstrumpf! Du hast das Memory in nur {0} Zügen ausgeräumt!", Math.Floor((double)moves / 2)), "Yeehaw!"); + } } } };