[gbrainy/new-games] Two men puzzle more random
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy/new-games] Two men puzzle more random
- Date: Mon, 12 Mar 2018 19:46:19 +0000 (UTC)
commit 8b99125d341907f9876dee37f4b36b62d0dd79d4
Author: Jordi Mas <jmas softcatala org>
Date: Mon Mar 12 20:46:06 2018 +0100
Two men puzzle more random
data/games.xml | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/data/games.xml b/data/games.xml
index f89166e..8e69301 100644
--- a/data/games.xml
+++ b/data/games.xml
@@ -810,27 +810,43 @@
<type>Logic</type>
<difficulty>All</difficulty>
<answer_checkattributes>MultiOption | IgnoreSpaces</answer_checkattributes>
- <!-- Translators: Adapt 'feet' to the right unit of length for your locale. -->
- <_question>Two men starting at the same point walk in opposite directions for 4 feet. Both
turn left and walk another 3 feet. What is the distance between them? [option_answers]</_question>
+ <variables>
+ int [] dists_a = new int [] {3, 8, 12};
+ int [] dists_b = new int [] {4, 6, 9};
+ int [] dists_c = new int [] {5, 10, 15};
+
+ int index = random.Next (dists_a.Length);
+ int dist_a = dists_a[index];
+ int dist_b = dists_b[index];
+
+ int answer_a = dists_c[index];
+ int answer_b = dists_c[index] + 2 + random.Next (10);
+ int answer_c = answer_b + 2 + random.Next (5); // Based on answer_b to avoid
duplicated answers
+ int answer_d = dists_c[index] - 2;
+ </variables>
+
+ <!-- Translators: Adapt 'feet' to the right unit of length for your locale. -->
+ <_question>Two men starting at the same point walk in opposite directions for [dist_a] feet.
Both turn left and walk another [dist_b] feet. What is the distance between them? [option_answers]</_question>
+
<string _text = "Choose one of the following:" x = "0.1" y = "0.15" size = "large"/>
<option x = "0.3" y = "0.3" width ="0.45" height ="0.1" order ="randomized" correct =
"yes">
- <string text = "[option_prefix] 10" x = "0.05" y = "0.02" size = "large"/>
+ <string text = "[option_prefix] [answer_a]" x = "0.05" y = "0.02" size =
"large"/>
</option>
<option x = "0.3" y = "0.4" width ="0.45" height ="0.1" order ="randomized">
- <string text = "[option_prefix] 5" x = "0.05" y = "0.02" size = "large"/>
+ <string text = "[option_prefix] [answer_b]" x = "0.05" y = "0.02" size =
"large"/>
</option>
<option x = "0.3" y = "0.5" width ="0.45" height ="0.1" order ="randomized">
- <string text = "[option_prefix] 15" x = "0.05" y = "0.02" size = "large"/>
+ <string text = "[option_prefix] [answer_c]" x = "0.05" y = "0.02" size =
"large"/>
</option>
<option x = "0.3" y = "0.6" width ="0.45" height ="0.1" order ="randomized">
- <string text = "[option_prefix] 3" x = "0.05" y = "0.02" size = "large"/>
+ <string text = "[option_prefix] [answer_d]" x = "0.05" y = "0.02" size =
"large"/>
</option>
- <_rationale>Using the Pythagorean theorem, the solution is 2 by the square root of (4^2 + 3^2).
</_rationale>
- <answer>10</answer>
+ <_rationale>Using the Pythagorean theorem, the solution is 2 by the square root of ([dist_a]^2 +
[dist_b]^2). </_rationale>
+ <answer>[answer_a]</answer>
</game>
</games>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]