diff --git a/Lernprogramm3_Matchinggame/.vs/Lernprogramm3_Matchinggame/v17/.suo b/Lernprogramm3_Matchinggame/.vs/Lernprogramm3_Matchinggame/v17/.suo index edccf3f..f6ed18d 100644 Binary files a/Lernprogramm3_Matchinggame/.vs/Lernprogramm3_Matchinggame/v17/.suo and b/Lernprogramm3_Matchinggame/.vs/Lernprogramm3_Matchinggame/v17/.suo differ 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!"); + } } } };