[gbrainy] Pair of words compare analogies can have more than correct answer. Word these cases better



commit 37a479692dde7c751300bd38f5dbd12f6c754aef
Author: Jordi Mas <jmas softcatala org>
Date:   Sun Dec 4 15:09:43 2011 +0100

    Pair of words compare analogies can have more than correct answer. Word these cases better

 src/Core/Main/Game.cs                              |    2 +-
 .../Main/Verbal/AnalogiesPairOfWordsCompare.cs     |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index 2b5133a..129dabe 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -131,7 +131,7 @@ namespace gbrainy.Core.Main
 		}
 
 		// Builds a text answer for the puzzle
-		public string AnswerText {
+		public virtual string AnswerText {
 			get {
 				string str;
 
diff --git a/src/Core/Main/Verbal/AnalogiesPairOfWordsCompare.cs b/src/Core/Main/Verbal/AnalogiesPairOfWordsCompare.cs
index 6f8b039..3db3ce8 100644
--- a/src/Core/Main/Verbal/AnalogiesPairOfWordsCompare.cs
+++ b/src/Core/Main/Verbal/AnalogiesPairOfWordsCompare.cs
@@ -57,6 +57,26 @@ namespace gbrainy.Core.Main.Verbal
 			}
 		}
 
+		public override string AnswerText {
+			get {
+				string str;
+				string[] items;
+
+				items = Answer.Correct.Split (AnalogiesFactory.Separator);
+
+				str = String.Format (translations.GetPluralString ("The correct answer is {0}.",
+					"The possible correct answers are {0}.", items.Length),
+					Answer.CorrectShow);
+
+				if (String.IsNullOrEmpty (Rationale))
+					return str;
+
+				// Translators: answer + rationale of the answer
+				return String.Format (translations.GetString ("{0} {1}"), str, Rationale);
+			}
+		}
+
+
 		protected override void Initialize ()
 		{
 			Current = GetNext ();



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