43 |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
44 |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
45 |
{ |
{ |
46 |
char l = iGame.getBoardChar(row, col); |
char l = iGame.getBoard().getChar(row, col); |
47 |
out << setw(3) << (l ? l : '-'); |
out << setw(3) << (l ? l : '-'); |
48 |
} |
} |
49 |
out << endl; |
out << endl; |
65 |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
66 |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
67 |
{ |
{ |
68 |
char l = iGame.getBoardChar(row, col); |
char l = iGame.getBoard().getChar(row, col); |
69 |
bool j = (iGame.getBoardCharAttr(row, col) & ATTR_JOKER); |
bool j = (iGame.getBoard().getCharAttr(row, col) & ATTR_JOKER); |
70 |
|
|
71 |
out << " " << (j ? '.' : (l ? ' ' : '-')); |
out << " " << (j ? '.' : (l ? ' ' : '-')); |
72 |
out << (l ? l : '-'); |
out << (l ? l : '-'); |
90 |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
91 |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
92 |
{ |
{ |
93 |
char l = iGame.getBoardChar(row, col); |
char l = iGame.getBoard().getChar(row, col); |
94 |
if (l != 0) |
if (l != 0) |
95 |
out << " " << l; |
out << " " << l; |
96 |
else |
else |
97 |
{ |
{ |
98 |
int wm = iGame.getBoardWordMultiplier(row, col); |
int wm = iGame.getBoard().getWordMultiplier(row, col); |
99 |
int tm = iGame.getBoardLetterMultiplier(row, col); |
int tm = iGame.getBoard().getLetterMultiplier(row, col); |
100 |
|
|
101 |
if (wm > 1) |
if (wm > 1) |
102 |
out << " " << ((wm == 3) ? '@' : '#'); |
out << " " << ((wm == 3) ? '@' : '#'); |
125 |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
out << " " << (char)(row - BOARD_MIN + 'A') << " "; |
126 |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
for (col = BOARD_MIN; col <= BOARD_MAX; col++) |
127 |
{ |
{ |
128 |
char l = iGame.getBoardChar(row, col); |
char l = iGame.getBoard().getChar(row, col); |
129 |
int wm = iGame.getBoardWordMultiplier(row, col); |
int wm = iGame.getBoard().getWordMultiplier(row, col); |
130 |
int tm = iGame.getBoardLetterMultiplier(row, col); |
int tm = iGame.getBoard().getLetterMultiplier(row, col); |
131 |
|
|
132 |
if (wm > 1) |
if (wm > 1) |
133 |
out << " " << ((wm == 3) ? '@' : '#'); |
out << " " << ((wm == 3) ? '@' : '#'); |
149 |
|
|
150 |
for (it = allTiles.begin(); it != allTiles.end(); it++) |
for (it = allTiles.begin(); it != allTiles.end(); it++) |
151 |
{ |
{ |
152 |
if (iGame.getNCharInBag(it->toChar()) > 9) |
if (iGame.getBag().in(it->toChar()) > 9) |
153 |
out << " "; |
out << " "; |
154 |
out << setw(2) << it->toChar(); |
out << setw(2) << it->toChar(); |
155 |
} |
} |
157 |
|
|
158 |
for (it = allTiles.begin(); it != allTiles.end(); it++) |
for (it = allTiles.begin(); it != allTiles.end(); it++) |
159 |
{ |
{ |
160 |
out << " " << iGame.getNCharInBag(it->toChar()); |
out << " " << iGame.getBag().in(it->toChar()); |
161 |
} |
} |
162 |
out << endl; |
out << endl; |
163 |
} |
} |
165 |
|
|
166 |
void GameIO::printPlayedRack(ostream &out, const Game &iGame, int n) |
void GameIO::printPlayedRack(ostream &out, const Game &iGame, int n) |
167 |
{ |
{ |
168 |
out << iGame.getPlayerRack(iGame.currPlayer()) << endl; |
out << iGame.getCurrentPlayer().getCurrentRack().toString() << endl; |
169 |
} |
} |
170 |
|
|
171 |
|
|
174 |
for (int j = 0; j < iGame.getNPlayers(); j++) |
for (int j = 0; j < iGame.getNPlayers(); j++) |
175 |
{ |
{ |
176 |
out << "Joueur " << j << ": "; |
out << "Joueur " << j << ": "; |
177 |
out << iGame.getPlayerRack(j) << endl; |
out << iGame.getPlayer(j).getCurrentRack().toString() << endl; |
178 |
} |
} |
179 |
} |
} |
180 |
|
|
181 |
|
|
182 |
static void searchResultLine(ostream &out, const Training &iGame, int num) |
static void searchResultLine(ostream &out, const Training &iGame, int num) |
183 |
{ |
{ |
184 |
string word = iGame.getSearchedWord(num); |
Round r = iGame.getResults().get(num); |
185 |
if (word.size() == 0) |
string word = r.getWord(); |
186 |
return; |
if (word.size() == 0) |
187 |
out << word << string(16 - word.size(), ' ') |
return; |
188 |
<< (iGame.getSearchedBonus(num) ? '*' : ' ') |
out << word << string(16 - word.size(), ' ') |
189 |
<< setw(4) << iGame.getSearchedPoints(num) |
<< (r.getBonus() ? '*' : ' ') |
190 |
<< ' ' << iGame.getSearchedCoords(num); |
<< setw(4) << r.getPoints() |
191 |
|
<< ' ' << r.getCoord().toString(); |
192 |
} |
} |
193 |
|
|
194 |
|
|
195 |
void GameIO::printSearchResults(ostream &out, const Training &iGame, int num) |
void GameIO::printSearchResults(ostream &out, const Training &iGame, int num) |
196 |
{ |
{ |
197 |
for (int i = 0; i < num && i < iGame.getNResults(); i++) |
Results r = iGame.getResults(); |
198 |
|
for (int i = 0; i < num && i < r.size(); i++) |
199 |
{ |
{ |
200 |
out << setw(3) << i + 1 << ": "; |
out << setw(3) << i + 1 << ": "; |
201 |
searchResultLine(out, iGame, i); |
searchResultLine(out, iGame, i); |
206 |
|
|
207 |
void GameIO::printPoints(ostream &out, const Game &iGame) |
void GameIO::printPoints(ostream &out, const Game &iGame) |
208 |
{ |
{ |
209 |
out << iGame.getPlayerPoints(0) << endl; |
out << iGame.getPlayer(0).getPoints() << endl; |
210 |
} |
} |
211 |
|
|
212 |
|
|
215 |
for (int i = 0; i < iGame.getNPlayers(); i++) |
for (int i = 0; i < iGame.getNPlayers(); i++) |
216 |
{ |
{ |
217 |
out << "Joueur " << i << ": " |
out << "Joueur " << i << ": " |
218 |
<< setw(4) << iGame.getPlayerPoints(i) << endl; |
<< setw(4) << iGame.getPlayer(i).getPoints() << endl; |
219 |
} |
} |
220 |
} |
} |
221 |
|
|