eliot/game/freegame.h

70 lines
2.3 KiB
C
Raw Normal View History

/*****************************************************************************
* Copyright (C) 2005 Eliot
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* $Id: freegame.h,v 1.6 2005/03/29 06:56:06 afrab Exp $
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
#ifndef _FREEGAME_H_
#define _FREEGAME_H_
#include "game.h"
#include "tile.h"
using std::string;
using std::vector;
2005-03-27 19:30:48 +02:00
/**
* This class handles the logic specific to a "free" game.
*
* The algorithm is simple: players play at their turn, and they can either
* play a word or change letters (changing letters implies passing its turn).
*
* When a player has no more letters (end of the game), the points of the
* letters left in the racks of his opponents are added to his score, and
* removed from the score of the latters.
*/
class FreeGame: public Game
{
friend class GameFactory;
public:
virtual GameMode getMode() const { return kFREEGAME; }
2005-02-09 23:33:56 +01:00
virtual string getModeAsString() const { return "Free game"; }
/*************************
* Game handling
*************************/
virtual int start();
virtual int setRackRandom(int, bool, set_rack_mode);
virtual int play(const string &iCoord, const string &iWord);
virtual int endTurn();
virtual string getCurrentRack(int);
int pass(const string &iToChange, int n);
private:
// Private constructor and destructor to force using the GameFactory class
FreeGame(const Dictionary &iDic);
virtual ~FreeGame();
void freegameAI(int n);
void end();
int helperPass(const vector<Tile> &iToChange, int n);
};
#endif /* _FREEGAME_H_ */