[gbrainy] In memory count dots puzzle, we were not painting all dots in some cases plus we were always asking
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] In memory count dots puzzle, we were not painting all dots in some cases plus we were always asking
- Date: Sat, 24 Mar 2012 17:14:54 +0000 (UTC)
commit 8f05a7b2db168451d4c5e46a9ea684f0785732a6
Author: Jordi Mas <jmas softcatala org>
Date: Sat Mar 24 18:15:58 2012 +0100
In memory count dots puzzle, we were not painting all dots in some cases plus we were always asking for the red dot color in the question instead of random
src/Games/Memory/MemoryCountDots.cs | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/Games/Memory/MemoryCountDots.cs b/src/Games/Memory/MemoryCountDots.cs
index c2d9093..a468db2 100644
--- a/src/Games/Memory/MemoryCountDots.cs
+++ b/src/Games/Memory/MemoryCountDots.cs
@@ -30,6 +30,7 @@ namespace gbrainy.Games.Memory
private const int MINDOTS = 1;
private const int MAXDOTS = 25;
private int maxdotscolor;
+ private int question_color;
private ArrayListIndicesRandom location_order;
private ColorPalette palette;
@@ -49,7 +50,7 @@ namespace gbrainy.Games.Memory
return String.Format (
// Translators: {0} is the name of the color. The color name is always singular
Translations.GetString ("How many dots of {0} color were in the previous image? Answer using numbers."),
- palette.Name (0));
+ palette.Name (question_color));
}
}
@@ -71,6 +72,7 @@ namespace gbrainy.Games.Memory
location_order.Initialize();
palette = new ColorPalette (Translations);
+ question_color = random.Next (palette.Count);
// dotsPerColor is compared with iterator of dots. (this iterator is 0 based, so I
// have to substract 1 to make dotsPerColor contents 0 based.
@@ -80,8 +82,11 @@ namespace gbrainy.Games.Memory
before = dotsPerColor[i];
}
- Answer.Correct = (dotsPerColor[0]+1).ToString ();
-
+ if (question_color == 0)
+ Answer.Correct = (dotsPerColor[question_color] + 1).ToString ();
+ else
+ Answer.Correct = (dotsPerColor[question_color] - dotsPerColor[question_color - 1]).ToString ();
+
base.Initialize ();
}
@@ -126,7 +131,7 @@ namespace gbrainy.Games.Memory
pos_y = y + center_square;
pos_x = x + center_square;
- for (int i = 0,itcolor=0; i < MAXDOTS && itcolor<palette.Count; i++)
+ for (int i = 0,itcolor=0; i < NUMCOLUMNS*NUMCOLUMNS && itcolor<palette.Count; i++)
{
int dx,dy;
Color color = palette.Cairo(itcolor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]