#include <movements.h>
Public Methods | |
Movements () | |
Movements (std::vector< Move > const &moves) | |
Movements (QDataStream &stream) | |
Movements (QPoint keeper_start, QStringList &lines) | |
bool | isEmpty () const |
int | numberOfMoves () const |
void | setToFirstPosition () |
void | setToLastPosition () |
bool | hasNextMove () const |
Move | peekNextMove () const |
Move | nextMove () |
bool | hasPrevMove () const |
Move | peekPrevMove () const |
Move | prevMove () |
Move const & | move (int index) const |
void | addMove (Move const &move) |
void | addMovements (Movements const &moves) |
void | truncateToCurrent () |
int | movePointer () const |
void | setMovePointer (int move_pointer) |
void | reverse () |
Movements | gemMovesToKeeperMoves (QPoint const &keeper, bool retro_mode=false) const |
QString | toText () const |
void | writeToStream (QDataStream &stream) const |
int | moves () const |
int | pushes () const |
int | linearPushes () const |
int | gemChanges () const |
bool | operator== (Movements const &other_moves) const |
bool | operator!= (Movements const &other_moves) const |
Private Attributes | |
std::vector< Move > | m_moves |
size_t | m_pos |
Static Private Attributes | |
QRegExp | s_moves_regexp |
You can use this class in the spirit of a bidirectional iterator or a vector.
|
Creates an empty Movements object.
|
|
Constructs the object with the given moves. The move pointer points to the first move.
|
|
Constructs the object from a data stream. The move pointer points to the first move.
|
|
Constructs the movements from lines in sokogen format. Removes all lines from the QStringList, which were taken for building up the moves.
|
|
Adds a move. If the next move and the move to add are identical, nothing happens, apart from the fact, the we jump to the next move. If not, the added move is also the last move.
|
|
Adds moves. The last move of the added move is also the last move.
|
|
Returns the number of gem changes (the number of times a different gem has been pushed).
|
|
Converts a sequence of gems moves to a sequence of keeper moves. This assumes, the current moves are gem moves (holding the positions of the moves gem instead of the keeper). Note that the moves must be atomic!
|
|
Returns true, if there is a next move.
|
|
Returns true, if there is a previous move.
|
|
Returns true, if there are no moves.
|
|
Returns the number of linear pushes.
|
|
Returns the move with the given index.
|
|
Returns the move pointer as an index.
|
|
Returns the number of moves.
|
|
Returns the next move and increments the move pointer. This allows you traverse the movements forwards. |
|
The number of moves.
|
|
Return true, if two movements are different.
|
|
Return false, if two movements are different.
|
|
Returns the next move, but unlike nextMove() does not changes the move pointer.
|
|
Returns the previous move, but unlike prevMove() does not changes the move pointer.
|
|
Returns the previous move and decrements the move pointer. This allows you traverse the movements backwards. |
|
Returns the number of pushes.
|
|
Reverses the moves. The last move is the first move and so on. Note that the moves itself are the same (so from() of the first move will be from() of the last move). |
|
Sets the mover pointer. The pointer must be in the range [0:numberOfMoves()[.
|
|
Sets the move pointer to the first move. This means, that hasPrevMove() will return false after this call. |
|
Sets the move pointer to the last move. This means, that hasNextMove() will return false after this call. |
|
Returns a sokogen compatible form of the moves. Note that all moves must be atomic. |
|
Truncates the movements up to the current move. This means, hasNextMove() will return false. |
|
Writes the movements to a stream.
|
|
The movements.
|
|
The pointer to the next move.
|
|
The regexp for a valid sokogen moves lines.
|