gbrainy r487 - in trunk: po src src/PuzzleGames
- From: jmas svn gnome org
- To: svn-commits-list gnome org
- Subject: gbrainy r487 - in trunk: po src src/PuzzleGames
- Date: Mon, 29 Dec 2008 16:56:31 +0000 (UTC)
Author: jmas
Date: Mon Dec 29 16:56:31 2008
New Revision: 487
URL: http://svn.gnome.org/viewvc/gbrainy?rev=487&view=rev
Log:
New logic puzzle Handshakes
Added:
trunk/src/PuzzleGames/PuzzleHandshakes.cs
Modified:
trunk/po/POTFILES.in
trunk/src/ChangeLog
trunk/src/GameManager.cs
trunk/src/Makefile.am
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Mon Dec 29 16:56:31 2008
@@ -40,6 +40,7 @@
src/PuzzleGames/PuzzleFigurePattern.cs
src/PuzzleGames/PuzzleFigures.cs
src/PuzzleGames/PuzzleFourSided.cs
+src/PuzzleGames/PuzzleHandshakes.cs
src/PuzzleGames/PuzzleLargerShape.cs
src/PuzzleGames/PuzzleLines.cs
src/PuzzleGames/PuzzleMatrixGroups.cs
Modified: trunk/src/GameManager.cs
==============================================================================
--- trunk/src/GameManager.cs (original)
+++ trunk/src/GameManager.cs Mon Dec 29 16:56:31 2008
@@ -68,7 +68,8 @@
typeof (PuzzleExtraCircle),
typeof (PuzzleCountSeries),
typeof (PuzzleFourSided),
- typeof (PuzzleLargerShape),
+ typeof (PuzzleLargerShape),
+ typeof (PuzzleHandshakes),
};
static Type[] CalculationTrainersInternal = new Type[]
@@ -182,7 +183,7 @@
AddinManager.Initialize (dir);
Console.WriteLine ("Pluggin database:" + dir);
AddinManager.Registry.Update (null);
- SetupService setupService = new SetupService (AddinManager.Registry);
+ new SetupService (AddinManager.Registry);
addins = AddinManager.GetExtensionNodes ("/gbrainy/games/logic");
foreach (TypeExtensionNode node in addins) {
@@ -309,7 +310,7 @@
}
puzzle = (Game) Activator.CreateInstance ((Type) games [(int) enumerator.Current], true);
- //puzzle = (Game) Activator.CreateInstance (LogicPuzzles [32], true);
+ //puzzle = (Game) Activator.CreateInstance (LogicPuzzles [37], true);
if (first != null && first.GetType () == puzzle.GetType ())
break;
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Dec 29 16:56:31 2008
@@ -70,6 +70,7 @@
$(srcdir)/SVGImage.cs \
$(srcdir)/MemoryGames/MemoryNumbers.cs \
$(srcdir)/AboutDialog.cs \
+ $(srcdir)/PuzzleGames/PuzzleHandshakes.cs \
$(srcdir)/gbrainy.cs
ASSEMBLIES = \
Added: trunk/src/PuzzleGames/PuzzleHandshakes.cs
==============================================================================
--- (empty file)
+++ trunk/src/PuzzleGames/PuzzleHandshakes.cs Mon Dec 29 16:56:31 2008
@@ -0,0 +1,69 @@
+/*
+ * 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 Cairo;
+using Mono.Unix;
+using System;
+
+public class PuzzleHandshakes : Game
+{
+ int people, handshakes;
+
+ public override string Name {
+ get {return Catalog.GetString ("Handshakes");}
+ }
+
+ public override string Question {
+ get {return String.Format (
+ Catalog.GetString ("In a party all the people is introduced to the others. There are {0} handeshakes in total. How many people is in the party?"), handshakes);
+ }
+ }
+
+ public override string Tip {
+ get { return Catalog.GetString ("Try to imagine a situation where you were meeting a smaller number of people.");}
+ }
+
+ public override void Initialize ()
+ {
+ handshakes = 0;
+
+ switch (CurrentDifficulty) {
+ case Difficulty.Easy:
+ people = 4 + random.Next (4);
+ break;
+ case Difficulty.Master:
+ people = 5 + random.Next (8);
+ break;
+ case Difficulty.Medium:
+ default:
+ people = 5 + random.Next (4);
+ break;
+ }
+
+ for (int i = 1; i < people; i++)
+ handshakes += i;
+
+ right_answer = people.ToString ();
+ }
+
+ public override void Draw (CairoContextEx gr, int area_width, int area_height)
+ {
+ base.Draw (gr, area_width, area_height);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]