2 |
* Copyright (C) 2005 Eliot |
* Copyright (C) 2005 Eliot |
3 |
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr> |
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr> |
4 |
* |
* |
5 |
|
<<<<<<< duplicate.h |
6 |
|
======= |
7 |
* $Id$ |
* $Id$ |
8 |
* |
* |
9 |
|
>>>>>>> 1.9 |
10 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
11 |
* 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 |
12 |
* the Free Software Foundation; either version 2 of the License, or |
* the Free Software Foundation; either version 2 of the License, or |
22 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
23 |
*****************************************************************************/ |
*****************************************************************************/ |
24 |
|
|
25 |
|
/* $Id$ */ |
26 |
|
|
27 |
#ifndef _DUPLICATE_H_ |
#ifndef _DUPLICATE_H_ |
28 |
#define _DUPLICATE_H_ |
#define _DUPLICATE_H_ |
29 |
|
|
30 |
#include "game.h" |
#include "game.h" |
31 |
|
|
|
using std::string; |
|
|
|
|
|
|
|
32 |
/** |
/** |
33 |
* This class handles the logic specific to a duplicate game. |
* This class handles the logic specific to a duplicate game. |
34 |
* The trick in this mode is that the players will not necessarily play they |
* The trick in this mode is that the players will not necessarily play they |
55 |
friend class GameFactory; |
friend class GameFactory; |
56 |
public: |
public: |
57 |
virtual GameMode getMode() const { return kDUPLICATE; } |
virtual GameMode getMode() const { return kDUPLICATE; } |
58 |
virtual string getModeAsString() const { return "Duplicate"; } |
virtual std::string getModeAsString() const { return "Duplicate"; } |
59 |
|
|
60 |
/************************* |
/************************* |
61 |
* Game handling |
* Game handling |
62 |
*************************/ |
*************************/ |
63 |
virtual int start(); |
virtual int play(int player, Round& round); |
64 |
virtual int setRackRandom(int, bool, set_rack_mode); |
virtual int back(); |
|
virtual int play(const string &iCoord, const string &iWord); |
|
|
virtual int endTurn(); |
|
|
|
|
|
int setPlayer(int); |
|
|
// Switch to the previous human player who has not played yet |
|
|
void prevHumanPlayer(); |
|
|
// Switch to the next human player who has not played yet |
|
|
void nextHumanPlayer(); |
|
65 |
|
|
66 |
private: |
private: |
67 |
// Private constructor and destructor to force using the GameFactory class |
// Private constructor and destructor to force using the GameFactory class |
68 |
Duplicate(const Dictionary &iDic); |
Duplicate(const Dictionary iDic); |
69 |
virtual ~Duplicate(); |
virtual ~Duplicate(); |
70 |
|
|
|
void playRound(const Round &iRound, int n); |
|
|
int endTurnForReal(); |
|
|
void end(); |
|
|
void duplicateAI(int n); |
|
|
|
|
71 |
// m_hasPlayed[p] is true iff player p has played for this turn |
// m_hasPlayed[p] is true iff player p has played for this turn |
72 |
map<int, bool> m_hasPlayed; |
std::map <int, bool> m_hasPlayed; |
73 |
}; |
}; |
74 |
|
|
75 |
#endif /* _DUPLICATE_H_ */ |
#endif /* _DUPLICATE_H_ */ |