[gbrainy] Small bug fixes to three games



commit a559e8e6b53337ee35ec438bf7dcc5d7991314a8
Author: Jordi Mas <jmas softcatala org>
Date:   Tue Aug 17 17:13:41 2010 +0200

    Small bug fixes to three games

 data/games.xml                                 |    2 +-
 data/verbal_analogies.xml                      |    2 +-
 src/Games/Calculation/CalculationTwoNumbers.cs |   18 +++++++++++-------
 3 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/data/games.xml b/data/games.xml
index aef623b..e35676e 100644
--- a/data/games.xml
+++ b/data/games.xml
@@ -246,7 +246,7 @@
 				int rslt_b = years_end [idx + 1];
 			</variables>
 			<_question>[year_start] was a palindromic year as [year_end] was, a gap of 11 years. What are the next two consecutive palindromic years after [year_end] with the same gap?</_question>
-			<_tip>A palindromic number is number that remains the same when its digits are reversed (e.g.: 2112).</_tip>
+			<_tip>A palindromic number remains the same when its digits are reversed (e.g.: 2112).</_tip>
 			<answer>[rslt_a] | [rslt_b]</answer>
 			<_answer_show>[rslt_a] and [rslt_b]</_answer_show>
 			<answer_expression>[0-9]+</answer_expression>
diff --git a/data/verbal_analogies.xml b/data/verbal_analogies.xml
index a961d22..8366203 100644
--- a/data/verbal_analogies.xml
+++ b/data/verbal_analogies.xml
@@ -337,7 +337,7 @@
 
 	<analogy>
 		<_question type = "PairOfWordsCompare">dog / tame | wolf</_question>
-		<_answer correct ="yes">wild</_answer>
+		<_answer correct ="yes">wild | savage</_answer>
 	</analogy>
 
 	<analogy>
diff --git a/src/Games/Calculation/CalculationTwoNumbers.cs b/src/Games/Calculation/CalculationTwoNumbers.cs
index bd2f42f..24c3eed 100644
--- a/src/Games/Calculation/CalculationTwoNumbers.cs
+++ b/src/Games/Calculation/CalculationTwoNumbers.cs
@@ -143,17 +143,21 @@ namespace gbrainy.Games.Calculation
 
 			// Support case: -b - (-a) / (-b) * (-a)
 			if (type == SubGameTypes.Subtraction) {
-				int tmp;
+				int num_a, num_b;
+	
+				num_a = number_a;
+				num_b = number_b;
+				number_a = -num_b;
+				number_b = -num_a;
 
-				// No need to preserve original values since after CheckAnswer game is consider finished
-				tmp = number_a;
-				number_a = -number_b;
-				number_b = -tmp;
 				right_answer = String.Format ("{0} | {1}", number_a, number_b);
 				attributes = GameAnswerCheckAttributes.Trim | GameAnswerCheckAttributes.MatchAllInOrder;
-				return base.CheckAnswer (answer);
-			}
+				if (base.CheckAnswer (answer) == true) 
+					return true;
 
+				number_a = num_a;
+				number_b = num_b;
+			}
 			return false;
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]