gbrainy r339 - trunk/src
- From: jmas svn gnome org
- To: svn-commits-list gnome org
- Subject: gbrainy r339 - trunk/src
- Date: Tue, 13 May 2008 10:42:24 +0100 (BST)
Author: jmas
Date: Tue May 13 09:42:24 2008
New Revision: 339
URL: http://svn.gnome.org/viewvc/gbrainy?rev=339&view=rev
Log:
2008-05-12 Jordi Mas <jmas softcatala org>
* PuzzleCountSeries.cs: Better question
* PuzzleFourSided.cs: New logic puzzle
* Makefile.am: New logic puzzle
* GameManager.cs: New logic puzzle
Added:
trunk/src/PuzzleFourSided.cs
Modified:
trunk/src/ChangeLog
trunk/src/GameDrawingArea.cs
trunk/src/GameManager.cs
trunk/src/Makefile.am
trunk/src/Preferences.cs
trunk/src/PuzzleCountSeries.cs
Modified: trunk/src/GameDrawingArea.cs
==============================================================================
--- trunk/src/GameDrawingArea.cs (original)
+++ trunk/src/GameDrawingArea.cs Tue May 13 09:42:24 2008
@@ -303,7 +303,7 @@
y += 0.08;
for (int i = 0; i < tips_shown; i++)
{
- y = gr.DrawStringWithWrapping (x, y, space_small, "- " + GetTip ((int) random_indices[i]));
+ y = gr.DrawStringWithWrapping (x, y, space_small, "- " + GetTip (random_indices[i]));
if (y > 0.85)
break;
Modified: trunk/src/GameManager.cs
==============================================================================
--- trunk/src/GameManager.cs (original)
+++ trunk/src/GameManager.cs Tue May 13 09:42:24 2008
@@ -61,6 +61,7 @@
typeof (PuzzleQuadrilaterals),
typeof (PuzzleExtraCircle),
typeof (PuzzleCountSeries),
+ typeof (PuzzleFourSided),
};
static Type[] CalculationTrainers = new Type[]
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue May 13 09:42:24 2008
@@ -65,6 +65,7 @@
$(srcdir)/PlayerHistoryDialog.cs \
$(srcdir)/GtkDialog.cs \
$(srcdir)/Preferences.cs \
+ $(srcdir)/PuzzleFourSided.cs \
$(srcdir)/gbrainy.cs
ASSEMBLIES = \
Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs (original)
+++ trunk/src/Preferences.cs Tue May 13 09:42:24 2008
@@ -117,7 +117,6 @@
public void Save ()
{
try {
-
if (!Directory.Exists (config_path))
Directory.CreateDirectory (config_path);
Modified: trunk/src/PuzzleCountSeries.cs
==============================================================================
--- trunk/src/PuzzleCountSeries.cs (original)
+++ trunk/src/PuzzleCountSeries.cs Tue May 13 09:42:24 2008
@@ -55,8 +55,8 @@
switch ((GameType) random.Next ((int) GameType.Length))
{
case GameType.HowManyNines:
- question = Catalog.GetString ("How many 9 digits are needed to represent the numbers between 10 to 100?");
- right_answer = "20";
+ question = Catalog.GetString ("How many numbers 9 are needed to represent the numbers between 10 to 100?");
+ right_answer = "19";
break;
case GameType.HowManyBiggerDigits:
Added: trunk/src/PuzzleFourSided.cs
==============================================================================
--- (empty file)
+++ trunk/src/PuzzleFourSided.cs Tue May 13 09:42:24 2008
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2008 Jordi Mas i HernÃndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+using System;
+using Cairo;
+using Mono.Unix;
+
+public class PuzzleFourSided : Game
+{
+ int type;
+ public override string Name {
+ get {return Catalog.GetString ("Four sided");}
+ }
+
+ public override string Question {
+ get {return Catalog.GetString ("How many four sided figures do you count in the figure below?");}
+ }
+
+ public override string Tip {
+ get { return Catalog.GetString ("A four sided figure can be embedded inside another figure.");}
+ }
+
+ public override string Answer {
+ get {
+ string answer = base.Answer + " ";
+
+ answer += String.Format (Catalog.GetString ("The four sided figures are made by connecting the following points: {0}"),
+ (type == 0) ? "abde, degh, bcef, efhi, acdf, dfgi, abhg, bcih, acig, aghe, aefc, deig, bcie." :
+ "abde, degh, bcef, efhi, acdf, dfgi, abhg, bcih, acig, aghe, aefc, deig, bcie, acde, cehi, abeg, egif.");
+
+ return answer;
+ }
+ }
+
+ public override void Initialize ()
+ {
+ if (CurrentDifficulty==Difficulty.Easy)
+ type = 0;
+ else
+ type = random.Next (2);
+
+
+ if (type == 0)
+ right_answer = "13";
+ else
+ right_answer = "17";
+ }
+
+ public override void Draw (CairoContextEx gr, int area_width, int area_height)
+ {
+ double x = DrawAreaX + 0.1, y = DrawAreaY + 0.1, w = 0.6, h = 0.6;
+
+ gr.Scale (area_width, area_height);
+ DrawBackground (gr);
+ PrepareGC (gr);
+
+ gr.Rectangle (x, y, w, h);
+ gr.Stroke ();
+
+ // Lines
+ gr.MoveTo (x + w /2, y);
+ gr.LineTo (x + w /2, y + h);
+ gr.Stroke ();
+ gr.MoveTo (x, y + h /2);
+ gr.LineTo (x + w, y + h / 2);
+ gr.Stroke ();
+
+ // Diagonals
+ gr.MoveTo (x, y);
+ gr.LineTo (x + w, y + h);
+ gr.Stroke ();
+
+ if (type == 1) {
+ gr.MoveTo (x + w, y);
+ gr.LineTo (x, y + h);
+ gr.Stroke ();
+ }
+
+ if (DrawAnswer == false)
+ return;
+
+ // References
+ gr.MoveTo (x - 0.04, y - 0.02);
+ gr.ShowText ("a");
+ gr.Stroke ();
+
+ gr.MoveTo (x + w / 2 - 0.02, y - 0.02);
+ gr.ShowText ("b");
+ gr.Stroke ();
+
+ gr.MoveTo (x + w + 0.02, y - 0.02);
+ gr.ShowText ("c");
+ gr.Stroke ();
+
+ gr.MoveTo (x - 0.04, y + h /2 - 0.02);
+ gr.ShowText ("d");
+ gr.Stroke ();
+
+ gr.MoveTo (x + w / 2 - 0.04, y + h /2 - 0.04);
+ gr.ShowText ("e");
+ gr.Stroke ();
+
+ gr.MoveTo (x + w + 0.02, y + h /2 - 0.02);
+ gr.ShowText ("f");
+ gr.Stroke ();
+
+ gr.MoveTo (x - 0.04, y + h + 0.04);
+ gr.ShowText ("g");
+ gr.Stroke ();
+
+ gr.MoveTo (x + w / 2 - 0.02, y + h + 0.04);
+ gr.ShowText ("h");
+ gr.Stroke ();
+
+ gr.MoveTo (x + w + 0.02, y + h + 0.04);
+ gr.ShowText ("i");
+ gr.Stroke ();
+
+ }
+
+}
+
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]