-
Notifications
You must be signed in to change notification settings - Fork 0
/
boardparameters.h
154 lines (122 loc) · 3.57 KB
/
boardparameters.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
* Quackle -- Crossword game artificial intelligence and analysis tool
* Copyright (C) 2005-2006 Jason Katz-Brown and John O'Laughlin.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef QUACKLE_BOARDPARAMETERS_H
#define QUACKLE_BOARDPARAMETERS_H
#include "board.h"
namespace Quackle
{
class BoardParameters
{
public:
BoardParameters();
// Does not serialize name...caller still has to get/set name manually
void Serialize(ostream &stream);
static BoardParameters *Deserialize(istream &stream);
int width() const;
void setWidth(int width);
int height() const;
void setHeight(int width);
// start row and column are zero-indexed!
int startRow() const;
void setStartRow(int startRow);
int startColumn() const;
void setStartColumn(int startRow);
enum LetterMultiplier { sls=1, dls=2, tls=3, qls=4, lsCount = qls };
int letterMultiplier(int row, int column) const;
void setLetterMultiplier(int row, int column, LetterMultiplier multiplier);
enum WordMultiplier { sws=1, dws=2, tws=3, qws=4, wsCount = qws };
int wordMultiplier(int row, int column) const;
void setWordMultiplier(int row, int column, WordMultiplier multiplier);
// unused by libquackle
UVString name() const;
void setName(const UVString &name);
protected:
int m_width;
int m_height;
int m_startRow;
int m_startColumn;
int m_letterMultipliers[QUACKLE_MAXIMUM_BOARD_SIZE][QUACKLE_MAXIMUM_BOARD_SIZE];
int m_wordMultipliers[QUACKLE_MAXIMUM_BOARD_SIZE][QUACKLE_MAXIMUM_BOARD_SIZE];
UVString m_name;
};
inline int BoardParameters::width() const
{
return m_width;
}
inline void BoardParameters::setWidth(int width)
{
m_width = width;
}
inline int BoardParameters::height() const
{
return m_height;
}
inline void BoardParameters::setHeight(int height)
{
m_height = height;
}
inline int BoardParameters::startRow() const
{
return m_startRow;
}
inline void BoardParameters::setStartRow(int startRow)
{
m_startRow = startRow;
}
inline int BoardParameters::startColumn() const
{
return m_startColumn;
}
inline void BoardParameters::setStartColumn(int startColumn)
{
m_startColumn = startColumn;
}
inline int BoardParameters::letterMultiplier(int row, int column) const
{
return m_letterMultipliers[row][column];
}
inline void BoardParameters::setLetterMultiplier(int row, int column, BoardParameters::LetterMultiplier multiplier)
{
m_letterMultipliers[row][column] = (int) multiplier;
}
inline int BoardParameters::wordMultiplier(int row, int column) const
{
return m_wordMultipliers[row][column];
}
inline void BoardParameters::setWordMultiplier(int row, int column, BoardParameters::WordMultiplier multiplier)
{
m_wordMultipliers[row][column] = (int) multiplier;
}
inline UVString BoardParameters::name() const
{
return m_name;
}
inline void BoardParameters::setName(const UVString &name)
{
m_name = name;
}
// Name: A Random Board I Dislike
class EnglishBoard : public BoardParameters
{
public:
EnglishBoard();
};
}
#endif