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

« back to all changes in this revision

Viewing changes to src/Game.cs

  • Committer: Bazaar Package Importer
  • Author(s): Siegfried-Angel Gevatter Pujals, Jo Shields, Siegfried-Angel Gevatter Pujals
  • Date: 2009-11-17 19:23:40 UTC
  • mfrom: (1.3.1 upstream) (9.1.8 karmic)
  • Revision ID: james.westby@ubuntu.com-20091117192340-ek9lvn4ag5913tg7
Tags: 1.20-1
[ Jo Shields ]
* debian/rules
  + Policy-compliant location for get-orig-source rule
  + Remove spurious call to --repack in get-orig-source rule

[ Siegfried-Angel Gevatter Pujals ]
* New upstream release:
  + Six new games, including a new game type (verbal analogies).
  + Bug fixes and new translations.
* Bump Standards-Version to 3.8.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
abstract public class Game
24
24
{
 
25
        // See: GetGameTypeDescription
25
26
        public enum Types
26
27
        {       
27
28
                None                    = 0,
28
29
                LogicPuzzle             = 2,
29
30
                MemoryTrainer           = 4,
30
 
                MathTrainer             = 8
 
31
                MathTrainer             = 8,
 
32
                VerbalAnalogy           = 16,
31
33
        }
32
34
 
33
35
        public enum Difficulty
47
49
        private bool won;
48
50
        private bool tip_used;
49
51
        private Difficulty difficulty;
50
 
        private bool trace_score = false; // Set to true to debug scoring
51
52
 
52
53
        protected Game ()
53
54
        {
123
124
                set { draw_answer = value; }
124
125
        }
125
126
 
 
127
        // An initialized game cannot be playable (for example, missing external files)
 
128
        public virtual bool IsPlayable {
 
129
                get { return true;}
 
130
        }
 
131
 
126
132
        public virtual double DrawAreaX {
127
133
                get {return 0.1;}
128
134
        }
213
219
                                }
214
220
                        }
215
221
 
216
 
                        if (trace_score) {
217
 
                                Console.WriteLine ("Score for game {0} is {1}. Used tip {2}, time used {3}, time expected {4}", 
218
 
                                        this, (int) score, tip_used, seconds, AverageTime);
219
 
                        }
220
 
 
221
222
                        return (int) score;
222
223
                }
223
224
        }
229
230
        {
230
231
                switch (answer) {
231
232
                        // Translators Note
232
 
                        // The following serie of answers may need to be adapted
 
233
                        // The following series of answers may need to be adapted
233
234
                        // in cultures with alphabets different to the Latin one.
234
235
                        // The idea is to enumerate a sequence of possible answers
235
236
                        // For languages represented with the Latin alphabet use 
236
237
                        // the same than English
237
 
                case 0: // First possible answer for a serie (e.g.: Figure A)
 
238
                case 0: // First possible answer for a series (e.g.: Figure A)
238
239
                        return Catalog.GetString ("A");
239
 
                case 1: // Second possible answer for a serie
 
240
                case 1: // Second possible answer for a series
240
241
                        return Catalog.GetString ("B");
241
 
                case 2: // Third possible answer for a serie
 
242
                case 2: // Third possible answer for a series
242
243
                        return Catalog.GetString ("C");
243
 
                case 3: // Fourth possible answer for a serie
 
244
                case 3: // Fourth possible answer for a series
244
245
                        return Catalog.GetString ("D");
245
 
                case 4: // Fifth possible answer for a serie
 
246
                case 4: // Fifth possible answer for a series
246
247
                        return Catalog.GetString ("E");
247
 
                case 5: // Sixth possible answer for a serie
 
248
                case 5: // Sixth possible answer for a series
248
249
                        return Catalog.GetString ("F");
249
 
                case 6: // Seventh possible answer for a serie
 
250
                case 6: // Seventh possible answer for a series
250
251
                        return Catalog.GetString ("G");
251
 
                case 7: // Eighth possible answer for a serie
 
252
                case 7: // Eighth possible answer for a series
252
253
                        return Catalog.GetString ("H");
253
254
                default:
254
255
                        return string.Empty;
293
294
                }
294
295
                return rslt;
295
296
        }
 
297
 
 
298
        // Type enum to string representation
 
299
        static public string GetGameTypeDescription (Types type)
 
300
        {
 
301
                string str;
 
302
 
 
303
                switch (type) 
 
304
                {
 
305
                        case Game.Types.LogicPuzzle:
 
306
                                str = Catalog.GetString ("Logic");
 
307
                                break;
 
308
                        case Game.Types.MemoryTrainer:
 
309
                                str = Catalog.GetString ("Memory");
 
310
                                break;
 
311
                        case Game.Types.MathTrainer:
 
312
                                str = Catalog.GetString ("Mental Calculation");
 
313
                                break;
 
314
                        case Game.Types.VerbalAnalogy:
 
315
                                str = Catalog.GetString ("Verbal");
 
316
                                break;
 
317
                        default:
 
318
                                str = string.Empty;
 
319
                                break;
 
320
                }
 
321
                return str;
 
322
        }
296
323
}
297
324