|
Cute Chess
0.1
|
A chess piece. More...
#include <piece.h>
Public Member Functions | |
| bool | isEmpty () const |
| bool | isValid () const |
| bool | isWall () const |
| bool | operator!= (const Piece &other) const |
| bool | operator< (const Piece &other) const |
| bool | operator== (const Piece &other) const |
| bool | operator> (const Piece &other) const |
| Piece (int type=NoPiece) | |
| Piece (Side side, int type) | |
| void | setSide (Side side) |
| void | setType (int type) |
| Side | side () const |
| int | type () const |
Static Public Attributes | |
| static const int | NoPiece = 0 |
| static const int | WallPiece = 100 |
A chess piece.
The Piece class represents the contents of a square on the chessboard. It can be an empty piece (NoPiece) or a wall piece (WallPiece) belonging to neither player (NoSide), or it can be any chess piece belonging to either White or Black.
For performance reasons the class is just a wrapper for integer, and it has a constructor for implicitly converting integers to Piece objects.
|
inline |
Creates a new piece of type type for NoSide.
|
inline |
Creates a new piece of type type for side.
|
inline |
Returns true if the piece is empty (type is NoPiece).
|
inline |
Returns true if this is a valid chess piece.
|
inline |
Returns true if this is a wall piece (inaccessible square).
|
inline |
Returns true if other is different from this piece.
|
inline |
Returns true if this piece is less than other.
|
inline |
Returns true if other is the same as this piece.
|
inline |
Returns true if this piece is more than other.
|
inline |
Sets the side to side.
|
inline |
Sets the type to type.
|
inline |
Returns the side the piece belongs to.
|
inline |
Returns the type of the piece.
|
static |
No piece. Used for empty squares.
|
static |
A wall square outside of board.
1.8.11