Preliminary port of Shogi to the component API.
[tagua/yd.git] / src / variants / shogi / types / dragonking.cpp
blobca1145898dea4404f8d87e7436c2cdd2fbcc73df
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"
13 namespace Shogi {
15 DragonKing::DragonKing() {
16 MoveDefinition movesDefinition[] = {
17 {-1, 1, 1 },
18 { 0, 1, 0 },
19 { 1, 1, 1 },
20 {-1, 0, 0 },
21 { 1, 0, 0 },
22 {-1, -1, 1 },
23 { 0, -1, 0 },
24 { 1, -1, 1 },
27 for (unsigned i = 0; i < sizeof(movesDefinition)/sizeof(movesDefinition[0]); i++)
28 m_moveDefinitions.push_back(movesDefinition[i]);
31 QString DragonKing::name() const { return "dragonking"; }
33 const std::vector<MoveDefinition> * const DragonKing::movesDefinitions() const {
34 return &m_moveDefinitions;
37 int DragonKing::index() const { return 50; }
39 DragonKing* DragonKing::self() {
40 static DragonKing s_instance;
41 return &s_instance;