refresh bdc45694d411cad215e68161e75bb9f1a8a39e47
[tagua/yd.git] / src / variants / shogi / faces / dragonking.cpp
blobdc3f9c7d8374840ee1310094b4ba2f407fee0213
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
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 #include "dragonking.h"
12 #include <core/move.h>
13 #include <core/pathinfo.h>
14 #include <core/state.h>
15 #include <core/board.h>
17 namespace Shogi {
18 namespace Faces {
20 DragonKing::DragonKing() { }
22 QString DragonKing::name() const { return "rook"; }
24 bool DragonKing::canMove(const Piece& piece, const Piece& target,
25 Move& move, const IState* state) const {
26 PathInfo path = state->board()->path(move.src(), move.dst());
27 return path.parallel() && path.clear() && target.color() != piece.color();
30 int DragonKing::index() const { return 300; }
32 DragonKing* DragonKing::self() {
33 static DragonKing s_instance;
34 return &s_instance;