Ported crazyhouse MoveFactory and LegalityChecker.
[tagua/yd.git] / src / hlvariant / chess / piece.h
blob3f8aeb4ddf8ac1cfc8f9bf1b722e760b23812724
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@sns.it>
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.
9 */
11 #ifndef HLVARIANT__CHESS__PIECE_H
12 #define HLVARIANT__CHESS__PIECE_H
14 #include <QString>
15 #include "export.h"
17 namespace HLVariant {
18 namespace Chess {
20 class TAGUA_EXPORT Piece {
21 public:
22 enum Color {
23 INVALID_COLOR = -1,
24 WHITE,
25 BLACK
27 enum Type {
28 INVALID_TYPE = -1,
29 PAWN,
30 KNIGHT,
31 BISHOP,
32 ROOK,
33 QUEEN,
34 KING
36 private:
37 Color m_color;
38 Type m_type;
39 public:
40 Piece(Color color = INVALID_COLOR, Type type = INVALID_TYPE);
41 virtual ~Piece();
43 virtual Color color() const;
44 virtual Type type() const;
46 virtual QString colorName() const;
47 static QString colorName(Color color);
48 virtual QString typeName() const;
49 static QString typeName(Type type);
50 virtual QString name() const;
52 static Color oppositeColor(Color color);
54 virtual bool operator==(const Piece& other) const;
55 virtual bool operator!=(const Piece& other) const;
58 } // namespace Chess
59 } // namespace HLVariant
61 #endif // HLVARIANT__CHESS__PIECE_H