#include <move.h>
Public Methods | |
Move () | |
Move (QPoint from, AtomicMove atomic_move, bool stone_pushed) | |
Move (QPoint from, QPoint to, bool stone_pushed) | |
Move (QDataStream &stream) | |
bool | isEmpty () const |
QPoint | from () const |
QPoint | to () const |
bool | stonePushed () const |
bool | isAtomicMove () const |
AtomicMove | atomicMove () const |
bool | operator== (Move const &other_move) const |
bool | operator!= (Move const &other_move) const |
QPoint | diff () const |
QPoint | diffSign () const |
void | reverse () |
QString | toText () const |
void | writeToStream (QDataStream &stream) const |
Private Methods | |
int | sign (int number) const |
Private Attributes | |
QPoint | m_from |
QPoint | m_to |
bool | m_stone_pushed |
A single move may consist of more than one atomic move (an atomic move is a move one field left, up, right or down). If you want to get the atomic moves for a move, look at the documentation of Map (because they may depend on the layout of the map).
For a non pushing move (a move were the keeper does not pushes a stone) there are no restrictions, while for a pushing move we are only allowed to move in one direction. For example:
Move move1(QPoint(1, 0), QPoint(7, 12), false); // This is OK. Move move2(QPoint(1, 0), QPoint(3, 0), true); // This is also OK. Move move3(QPoint(1, 0), QPoint(1, 7), true); // And so is this. Move move4(QPoint(1, 0), QPoint(7, 12), true); // But this is an error!
|
Constructs an empty move (a move from (0, 0) to (0, 0)).
|
|
Constructs the move.
|
|
Constructs the move.
|
|
Constructs the move by reading it from a data stream.
|
|
Returns a code for the move. Note that the move <e>must</e> be an atomic move! |
|
|
|
Returns the sign (-1, 0 or 1) of every element in diff().
|
|
Returns the from point of the move.
|
|
Returns true, if the move is an atomic move (the keeper moves only one field).
|
|
Returns true, if the move is empty (meaning no movement of the keeper is involved).
|
|
Returns true, if two moves are unequal.
|
|
Returns true, if two moves are equal.
|
|
Swaps from and to.
|
|
Is there really no sign function? Hard to belive.
|
|
Returns true, if the move was a stone move.
|
|
Returns the to point of the move.
|
|
Returns a human readable representation of the move,.
|
|
Writes the move to a QDataStream. Note that the x and y componets of the from and to position of the move must be in the range [0:128[. This should be no problem since the map is restricted to this size also.
|
|
The from point.
|
|
Are we pushing a stone?
|
|
The to point.
|