~ubuntu-branches/ubuntu/lucid/gbrainy/lucid

« back to all changes in this revision

Viewing changes to src/Games/Logic/PuzzleSquareSheets.cs

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-01-12 11:21:24 UTC
  • mfrom: (13.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100112112124-o4ztomxa0xfh2ulj
Tags: 1.30-1ubuntu1
* debian/control:
  - Revert build-depends to lucid versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2007 Jordi Mas i Hernàndez <jmas@softcatala.org>
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
18
 */
 
19
 
 
20
using Cairo;
 
21
using Mono.Unix;
 
22
using System;
 
23
 
 
24
using gbrainy.Core.Main;
 
25
using gbrainy.Core.Libraries;
 
26
 
 
27
namespace gbrainy.Games.Logic
 
28
{
 
29
        public class PuzzleSquareSheets : Game
 
30
        {
 
31
                public override string Name {
 
32
                        get {return Catalog.GetString ("Square sheets");}
 
33
                }
 
34
 
 
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.");} 
 
37
                }
 
38
 
 
39
                public override string Tip {
 
40
                        get { return Catalog.GetString ("The sheets should overlap.");}
 
41
                }
 
42
 
 
43
                public override string Answer {
 
44
                        get { 
 
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.");
 
47
                                return answer;
 
48
                        }
 
49
                }
 
50
 
 
51
                public override void Initialize ()
 
52
                {
 
53
                        right_answer = "5";
 
54
                }
 
55
 
 
56
                public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
 
57
                {
 
58
                        double x = DrawAreaX + 0.2, y = DrawAreaY + 0.2, width = 0.4, height = 0.4;
 
59
 
 
60
                        base.Draw (gr, area_width, area_height, rtl);
 
61
 
 
62
                        gr.Rectangle (x, y, width, height);
 
63
                        gr.Stroke ();
 
64
                
 
65
                        gr.MoveTo (x, y + 0.1);
 
66
                        gr.LineTo (x + width, y + 0.1);  // First horizontal
 
67
                        gr.Stroke ();
 
68
 
 
69
                        gr.MoveTo (x, y + 0.3);
 
70
                        gr.LineTo (x + width - 0.1, y + 0.3); // Second horizontal
 
71
                        gr.Stroke ();
 
72
 
 
73
                        gr.MoveTo (x + 0.1, y);
 
74
                        gr.LineTo (x + 0.1, y + height);  // First vertical
 
75
                        gr.Stroke ();
 
76
 
 
77
                        gr.MoveTo (x + 0.3, y);
 
78
                        gr.LineTo (x + 0.3, y + height - 0.1);  // Second vertical
 
79
                        gr.Stroke ();
 
80
 
 
81
                        if (DrawAnswer == false)
 
82
                                return;
 
83
 
 
84
                        gr.LineTo (x + 0.04, y + 0.06);
 
85
                        gr.ShowPangoText ("1");
 
86
 
 
87
                        gr.LineTo (x + 0.18, y + 0.06);
 
88
                        gr.ShowPangoText ("2");
 
89
 
 
90
                        gr.LineTo (x + 0.34, y + 0.06);
 
91
                        gr.ShowPangoText ("3");
 
92
                
 
93
                        gr.LineTo (x + 0.04, y + 0.2);
 
94
                        gr.ShowPangoText ("2");
 
95
 
 
96
                        gr.LineTo (x + 0.18, y + 0.2);
 
97
                        gr.ShowPangoText ("4");
 
98
 
 
99
                        gr.LineTo (x + 0.34, y + 0.2);
 
100
                        gr.ShowPangoText ("5");
 
101
 
 
102
                        gr.LineTo (x + 0.04, y + 0.36);
 
103
                        gr.ShowPangoText ("3");
 
104
 
 
105
                }
 
106
        }
 
107
}
 
108
 
 
109