3 |
* Authors: Antoine Fraboulet <antoine.fraboulet@free.fr> |
* Authors: Antoine Fraboulet <antoine.fraboulet@free.fr> |
4 |
* Olivier Teuliere <ipkiss@via.ecp.fr> |
* Olivier Teuliere <ipkiss@via.ecp.fr> |
5 |
* |
* |
6 |
|
<<<<<<< training.h |
7 |
|
======= |
8 |
* $Id$ |
* $Id$ |
9 |
* |
* |
10 |
|
>>>>>>> 1.10 |
11 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
12 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
13 |
* the Free Software Foundation; either version 2 of the License, or |
* the Free Software Foundation; either version 2 of the License, or |
23 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
24 |
*****************************************************************************/ |
*****************************************************************************/ |
25 |
|
|
26 |
|
/* $Id$ */ |
27 |
|
|
28 |
#ifndef _TRAINING_H_ |
#ifndef _TRAINING_H_ |
29 |
#define _TRAINING_H_ |
#define _TRAINING_H_ |
30 |
|
|
33 |
#include "game.h" |
#include "game.h" |
34 |
#include "results.h" |
#include "results.h" |
35 |
|
|
|
using std::string; |
|
|
|
|
36 |
|
|
37 |
/** |
/** |
38 |
* This class handles the logic specific to a training game. |
* This class handles the logic specific to a training game. |
46 |
friend class GameFactory; |
friend class GameFactory; |
47 |
public: |
public: |
48 |
virtual GameMode getMode() const { return kTRAINING; } |
virtual GameMode getMode() const { return kTRAINING; } |
49 |
virtual string getModeAsString() const { return "Training"; } |
virtual std::string getModeAsString() const { return "Training"; } |
50 |
|
|
51 |
/************************* |
/************************* |
52 |
* Game handling |
* Game handling |
53 |
*************************/ |
*************************/ |
54 |
virtual int start(); |
|
55 |
virtual int setRackRandom(int, bool, set_rack_mode); |
/// play a round on the board |
56 |
virtual int play(const string &iCoord, const string &iWord); |
virtual int play(int player, Round& round); |
57 |
virtual int endTurn(); |
virtual int back(); |
58 |
|
|
59 |
|
/// search for the best possibilities |
60 |
void search(); |
void search(); |
61 |
int playResult(int); |
const Results& getResults() const { return m_results; } |
|
int setRackManual(bool iCheck, const string &iLetters); |
|
62 |
|
|
63 |
/************************* |
/// play result 'n' |
64 |
* Override the default behaviour of these methods, because in training |
int playResult(int); |
|
* we only want a human player |
|
|
*************************/ |
|
|
virtual void addHumanPlayer(); |
|
|
virtual void addAIPlayer(); |
|
|
|
|
|
/************************* |
|
|
* Functions to access the current search results |
|
|
* The int parameter should be 0 <= int < getNResults |
|
|
*************************/ |
|
|
int getNResults() const; |
|
|
string getSearchedWord(int) const; |
|
|
string getSearchedCoords(int) const; |
|
|
int getSearchedPoints(int) const; |
|
|
int getSearchedBonus (int) const; |
|
65 |
|
|
66 |
/// Place a temporary word on the board for preview purpose |
/// Place a temporary word on the board for preview purpose |
67 |
void testPlay(int); |
void testPlay(int); |
68 |
|
|
69 |
/// Remove the temporary word(s) |
/// Remove the temporary word(s) |
70 |
void removeTestPlay(); |
void removeTestPlay(); |
71 |
|
|
72 |
|
/// Get the temporary word |
73 |
|
std::string getTestPlayWord(); |
74 |
|
|
75 |
|
int setRack(PlayedRack::set_rack_mode mode, bool check, std::string rack); |
76 |
|
|
77 |
private: |
private: |
78 |
// Private constructor and destructor to force using the GameFactory class |
// Private constructor and destructor to force using the GameFactory class |
79 |
Training(const Dictionary &iDic); |
Training(const Dictionary iDic); |
80 |
virtual ~Training(); |
virtual ~Training(); |
81 |
|
|
82 |
// Search results, with all the possible rounds |
// Search results, with all the possible rounds |
83 |
|
Round testRound; |
84 |
Results m_results; |
Results m_results; |
85 |
}; |
}; |
86 |
|
|
87 |
#endif /* _TRAINING_H_ */ |
#endif /* _TRAINING_H_ */ |
88 |
|
|
89 |
|
|
90 |
|
/// Local Variables: |
91 |
|
/// mode: hs-minor |
92 |
|
/// c-basic-offset: 4 |
93 |
|
/// End: |