-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tile.h
executable file
·46 lines (35 loc) · 1.08 KB
/
Tile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Tile.h
*
* Created on: Sep 18, 2016
* Author: kempe
*/
/* Encodes a single tile. Basically acts like a struct,
without interesting computation. */
#ifndef TILE_H_
#define TILE_H_
class Tile {
public:
Tile (char letter, int points)
/* Constructor, initializing the letter and points.
The use may eventually differ from the letter for blanks tiles only.
*/
{ _letter = letter; _points = points; _use = letter; }
char getLetter () const { return _letter; }
/* Returns the letter on the tile ('?' for blanks). */
int getPoints () const { return _points; }
/* Returns the points for the tile. */
bool isBlank () const { return (_letter == '?'); }
/* Returns whether the tile is blank tile. */
char getUse () const { return _use; }
/* Returns what the tile is used as.
For letter tiles, this is just the letter.
For blank tiles, it can be set by the player when placing the tile. */
void useAs (char use) { _use = use; }
/* Sets the use of the tile to the given letter. */
protected:
char _letter;
char _use;
int _points;
};
#endif /* TILE_H_ */