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