2
* Copyright (C) 2007 Jordi Mas i Hernàndez <jmas@softcatala.org>
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2 of the
7
* License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* General Public License for more details.
14
* You should have received a copy of the GNU General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
24
using gbrainy.Core.Main;
25
using gbrainy.Core.Libraries;
27
namespace gbrainy.Games.Logic
29
public class PuzzleSquareSheets : Game
31
public override string Name {
32
get {return Catalog.GetString ("Square sheets");}
35
public override string Question {
36
get {return Catalog.GetString ("What is the minimum number of square sheets of paper of any size required to create the figure? Lines indicate frontiers between different sheets.");}
39
public override string Tip {
40
get { return Catalog.GetString ("The sheets should overlap.");}
43
public override string Answer {
45
string answer = base.Answer + " ";
46
answer += Catalog.GetString ("The numbers in the figure reflect the different areas covered by each one of the sheets.");
51
public override void Initialize ()
56
public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
58
double x = DrawAreaX + 0.2, y = DrawAreaY + 0.2, width = 0.4, height = 0.4;
60
base.Draw (gr, area_width, area_height, rtl);
62
gr.Rectangle (x, y, width, height);
65
gr.MoveTo (x, y + 0.1);
66
gr.LineTo (x + width, y + 0.1); // First horizontal
69
gr.MoveTo (x, y + 0.3);
70
gr.LineTo (x + width - 0.1, y + 0.3); // Second horizontal
73
gr.MoveTo (x + 0.1, y);
74
gr.LineTo (x + 0.1, y + height); // First vertical
77
gr.MoveTo (x + 0.3, y);
78
gr.LineTo (x + 0.3, y + height - 0.1); // Second vertical
81
if (DrawAnswer == false)
84
gr.LineTo (x + 0.04, y + 0.06);
85
gr.ShowPangoText ("1");
87
gr.LineTo (x + 0.18, y + 0.06);
88
gr.ShowPangoText ("2");
90
gr.LineTo (x + 0.34, y + 0.06);
91
gr.ShowPangoText ("3");
93
gr.LineTo (x + 0.04, y + 0.2);
94
gr.ShowPangoText ("2");
96
gr.LineTo (x + 0.18, y + 0.2);
97
gr.ShowPangoText ("4");
99
gr.LineTo (x + 0.34, y + 0.2);
100
gr.ShowPangoText ("5");
102
gr.LineTo (x + 0.04, y + 0.36);
103
gr.ShowPangoText ("3");