1 /*
2  Project: GShisen
3 
4  Copyright (C) 2003-2009 The GNUstep Application Project
5 
6  Author: Enrico Sersale, Riccardo Mottola
7 
8  Board View
9 
10  This application is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public
12  License as published by the Free Software Foundation; either
13  version 2 of the License, or (at your option) any later version.
14 
15  This application is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  Library General Public License for more details.
19 
20  You should have received a copy of the GNU General Public
21  License along with this library; if not, write to the Free
22  Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
23  */
24 
25 #import <Foundation/Foundation.h>
26 #import <AppKit/AppKit.h>
27 #import "tile.h"
28 #import "tilepair.h"
29 
30 #define GAME_STATE_RUNNING     1
31 #define GAME_STATE_PAUSED      0
32 
33 @interface GSBoard : NSView
34 {
35   NSUserDefaults *defaults;
36   NSMutableArray *scores;
37   NSArray *iconsNamesRefs;
38   NSMutableArray *tiles;
39   GSTile *firstTile, *secondTile;
40   NSTextField *timeField;
41   NSTimer *tmr;
42   int seconds, minutes;
43   BOOL hadEndOfGame;
44   NSMutableArray *undoArray;
45   int gameState;
46   int numScoresToKeep;
47 }
48 
49 - (id)initWithFrame:(NSRect)frameRect;
50 - (void)newGame;
51 - (void)undo;
52 - (void)timestep:(NSTimer *)t;
53 - (int)prepareTilesToRemove:(GSTile *)clickedTile;
54 - (void)removeCurrentTiles;
55 - (BOOL)findPathBetweenTiles;
56 - (BOOL)findSimplePathFromX1:(int)x1 y1:(int)y1 toX2:(int)x2 y2:(int)y2;
57 - (BOOL)canMakeLineFromX1:(int)x1 y1:(int)y1 toX2:(int)x2 y2:(int)y2;
58 - (void)unSetCurrentTiles;
59 - (void)pause;
60 - (void)getHint;
61 - (void)verifyEndOfGame;
62 - (void)endOfGame;
63 - (NSArray *)tilesAtXPosition:(int)xpos;
64 - (NSArray *)tilesAtYPosition:(int)ypos;
65 - (GSTile *)tileAtxPosition:(int)xpos yPosition:(int)ypos;
66 - (int)gameState;
67 - (NSMutableArray *)scores;
68 
69 @end
70 
71