2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2007 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
14 #include "taguaobject.h"
21 * @brief The state of the game in a given moment of time.
23 * A State component encapsulates the global state of the game, i.e.
24 * what pieces are on the board or on the pool, and game flags like
25 * the en-passant square for chess.
27 * A State component also provides methods to setup the initial
28 * configuration and to make a move.
30 class TAGUA_EXPORT IState
{
34 virtual IState
* clone() const = 0;
37 * Setup the initial configuration of pieces and reset all flags.
39 virtual void setup() = 0;
42 * @return The piece board.
44 virtual const Board
* board() const = 0;
45 virtual Board
* board() = 0;
48 * @return The player who plays next.
50 virtual const IColor
* turn() const = 0;
53 * Change the current turn.
55 virtual void setTurn(const IColor
* turn
) = 0;
58 * @return Whether two states are equal.
60 virtual bool equals(IState
* other
) const = 0;
63 * Make this state equal to the given one.
65 virtual void assign(const IState
* other
) = 0;
70 virtual void move(const Move
& move
) = 0;
73 * @return Current flags.
75 virtual TaguaObject
flags() const = 0;
78 * @return The opponent of @a color.
80 virtual const IColor
* opponent(const IColor
* color
) const = 0;
83 * Set next turn as the current turn.
85 virtual void advanceTurn() = 0;
88 #endif // CORE__STATE_H