Ported shogi.
[tagua/yd.git] / src / hlvariant / shogi / piece.h
blob761607eda45bd1ee460a6dfaab0841201e7ca4f5
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__SHOGI__PIECE_H
12 #define HLVARIANT__SHOGI__PIECE_H
14 #include <QString>
16 namespace HLVariant {
17 namespace Shogi {
19 class Piece {
20 public:
21 enum Color {
22 INVALID_COLOR = -1,
23 BLACK,
24 WHITE
26 enum Type {
27 KING,
28 GOLD,
29 SILVER,
30 KNIGHT,
31 LANCE,
32 ROOK,
33 BISHOP,
34 PAWN,
35 INVALID_TYPE = -1
37 private:
38 Color m_color;
39 Type m_type;
40 bool m_promoted;
41 public:
42 Piece(Color color = INVALID_COLOR, Type type = INVALID_TYPE);
43 virtual ~Piece();
45 virtual Color color() const;
46 virtual Type type() const;
48 virtual QString colorName() const;
49 static QString colorName(Color color);
50 virtual QString typeName() const;
51 static QString typeName(Type type);
52 virtual QString name() const;
54 static Color oppositeColor(Color color);
56 virtual bool operator==(const Piece& other) const;
57 virtual bool operator!=(const Piece& other) const;
59 void setPromoted();
62 } // namespace Shogi
63 } // namespace HLVariant
65 #endif // HLVARIANT__SHOGI__VARIANT_H