Preliminary port of Shogi to the component API.
[tagua/yd.git] / src / variants / shogi / types / bishop.cpp
blobbf39caa96129919f7796b59611acbb903317c3e3
1 /*
2 Copyright (c) 2008 Yann Dirson <ydirson@altern.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 */
10 #include "bishop.h"
12 namespace Shogi {
14 Bishop::Bishop() {
15 MoveDefinition movesDefinition[] = {
16 {-1, 1, 0 },
17 { 1, 1, 0 },
18 {-1, -1, 0 },
19 { 1, -1, 0 },
22 for (unsigned i = 0; i < sizeof(movesDefinition)/sizeof(movesDefinition[0]); i++)
23 m_moveDefinitions.push_back(movesDefinition[i]);
26 QString Bishop::name() const { return "bishop"; }
28 const std::vector<MoveDefinition> * const Bishop::movesDefinitions() const {
29 return &m_moveDefinitions;
32 int Bishop::index() const { return 35; }
34 Bishop* Bishop::self() {
35 static Bishop s_instance;
36 return &s_instance;