| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2002-2003 Andi Peredri * |
| 3 | * [email protected] * |
| 4 | * Copyright (C) 2004-2005 Artur Wiebe * |
| 5 | * [email protected] * |
| 6 | * * |
| 7 | * This program is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published by * |
| 9 | * the Free Software Foundation; either version 2 of the License, or * |
| 10 | * (at your option) any later version. * |
| 11 | * * |
| 12 | * This program is distributed in the hope that it will be useful, * |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 15 | * GNU General Public License for more details. * |
| 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
| 18 | * along with this program; if not, write to the * |
| 19 | * Free Software Foundation, Inc., * |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 21 | ***************************************************************************/ |
| 22 | |
| 23 | #ifndef CHECKERS_H |
| 24 | #define CHECKERS_Hcxx . . $ `src/checkers.h:24:9`! |
| 25 | |
| 26 | |
| 27 | #include <QString> |
| 28 | |
| 29 | #include "capture.h"cxx . . $ `<file>/src/capture.h`/ |
| 30 | |
| 31 | // do not change - hard coded |
| 32 | #define NONEcxx . . $ `src/checkers.h:32:9`! 0 |
| 33 | #define MAN1cxx . . $ `src/checkers.h:33:9`! 1 |
| 34 | #define KING1cxx . . $ `src/checkers.h:34:9`! 2 |
| 35 | #define FREEcxx . . $ `src/checkers.h:35:9`! 3 |
| 36 | #define KING2cxx . . $ `src/checkers.h:36:9`! 4 |
| 37 | #define MAN2cxx . . $ `src/checkers.h:37:9`! 5 |
| 38 | #define FULLcxx . . $ `src/checkers.h:38:9`! 6 |
| 39 | |
| 40 | #define ULcxx . . $ `src/checkers.h:40:9`! -6 |
| 41 | #define URcxx . . $ `src/checkers.h:41:9`! -5 |
| 42 | #define DLcxx . . $ `src/checkers.h:42:9`! 5 |
| 43 | #define DRcxx . . $ `src/checkers.h:43:9`! 6 |
| 44 | |
| 45 | |
| 46 | class Checkerscxx . . $ Checkers# |
| 47 | { |
| 48 | public: |
| 49 | Checkerscxx . . $ Checkers#Checkers(49f6e7a06ebc5aa8).(); |
| 50 | virtual ~cxx . . $ Checkers#`~Checkers`(ced63f7c635d850d).Checkerscxx . . $ Checkers#() {} |
| 51 | |
| 52 | bool setupcxx . . $ Checkers#setup(18a3c31ed0aa5760).(int setupboard[]); |
| 53 | virtual bool go1cxx . . $ Checkers#go1(cf9ef193275fa6d8).(int from, int to)=0; |
| 54 | |
| 55 | void go2cxx . . $ Checkers#go2(49f6e7a06ebc5aa8).(); |
| 56 | |
| 57 | void setSkillcxx . . $ Checkers#setSkill(d4f767463ce0a6b3).(int i) { levelmaxcxx . . $ Checkers#levelmax.=i; }; |
| 58 | int skillcxx . . $ Checkers#skill(455f465bc33b4cdf).() const { return levelmaxcxx . . $ Checkers#levelmax.; } |
| 59 | virtual int typecxx . . $ Checkers#type(455f465bc33b4cdf).() const = 0; |
| 60 | |
| 61 | int itemcxx . . $ Checkers#item(7ccb52b1bfe01045).(int i) const { return boardcxx . . $ Checkers#board.[internalcxx . . $ Checkers#internal(7ccb52b1bfe01045).(i)]; } |
| 62 | void setItemcxx . . $ Checkers#setItem(3e454b8ccf442868).(int i, int item) { boardcxx . . $ Checkers#board.[internalcxx . . $ Checkers#internal(7ccb52b1bfe01045).(i)] = item; } |
| 63 | |
| 64 | // string representation of the game board. |
| 65 | // set rotate to switch player sides. |
| 66 | QStringcxx . . $ QString# toStringcxx . . $ Checkers#toString(11ecdffe9192d1a2).(bool rotate) const; |
| 67 | bool fromStringcxx . . $ Checkers#fromString(e1defb592416720d).(const QStringcxx . . $ QString#&); |
| 68 | |
| 69 | // checks for a capture/move for particular stone in external |
| 70 | // representation. human player only. |
| 71 | bool canCapture1cxx . . $ Checkers#canCapture1(83c267b20bac841a).(int i) { return checkCapture1cxx . . $ Checkers#checkCapture1(83c267b20bac841a).(internalcxx . . $ Checkers#internal(7ccb52b1bfe01045).(i)); } |
| 72 | bool canMove1cxx . . $ Checkers#canMove1(83c267b20bac841a).(int i) { return checkMove1cxx . . $ Checkers#checkMove1(4a668f6de69bf818).(internalcxx . . $ Checkers#internal(7ccb52b1bfe01045).(i)); } |
| 73 | |
| 74 | bool checkMove1cxx . . $ Checkers#checkMove1(50ce9a9e25b4a850).() const; |
| 75 | bool checkMove2cxx . . $ Checkers#checkMove2(50ce9a9e25b4a850).() const; |
| 76 | virtual bool checkCapture1cxx . . $ Checkers#checkCapture1(50ce9a9e25b4a850).() const = 0; |
| 77 | virtual bool checkCapture2cxx . . $ Checkers#checkCapture2(50ce9a9e25b4a850).() const = 0; |
| 78 | |
| 79 | bool checkCapture1cxx . . $ Checkers#checkCapture1(83c267b20bac841a).(const int i) { |
| 80 | return ! getPossibleCapturecxx . . $ Checkers#getPossibleCapture(137a752fb5e47b28).(i)->isEmptycxx . . $ Captures#isEmpty(50ce9a9e25b4a850).(); |
| 81 | } |
| 82 | |
| 83 | Capturescxx . . $ Captures#* getPossibleCapturecxx . . $ Checkers#getPossibleCapture(c7fafa7f4063b43f).() const; |
| 84 | |
| 85 | QStringcxx . . $ QString# describeCapturecxx . . $ Checkers#describeCapture(6184de0e49b7442e).(bool, Capturescxx . . $ Captures#*) const; |
| 86 | |
| 87 | virtual QStringcxx . . $ QString# getFieldNotationcxx . . $ Checkers#getFieldNotation(f256c639af9cb348).(int, bool) const = 0; |
| 88 | |
| 89 | protected: |
| 90 | bool checkMove1cxx . . $ Checkers#checkMove1(4a668f6de69bf818).(int) const; |
| 91 | virtual Capturescxx . . $ Captures#* getPossibleCapturecxx . . $ Checkers#getPossibleCapture(137a752fb5e47b28).(int) const = 0; |
| 92 | |
| 93 | int levelcxx . . $ Checkers#level.; // Current level |
| 94 | int levelmaxcxx . . $ Checkers#levelmax.; // Maximum level |
| 95 | |
| 96 | int turncxx . . $ Checkers#turn(b126dc7c1de90089).(); |
| 97 | void turncxx . . $ Checkers#turn(7e65520a44544ef2).(int&, bool capture=false); |
| 98 | |
| 99 | int tocxx . . $ Checkers#to.; |
| 100 | int boardcxx . . $ Checkers#board.[54]; |
| 101 | int bestboardcxx . . $ Checkers#bestboard.[54]; |
| 102 | int bestcountercxx . . $ Checkers#bestcounter.; |
| 103 | |
| 104 | virtual void kingMove2cxx . . $ Checkers#kingMove2(1965396aac34c046).(int,int &)=0; |
| 105 | |
| 106 | virtual bool manCapture2cxx . . $ Checkers#manCapture2(68c9db8035e6a341).(int,int &)=0; |
| 107 | virtual bool kingCapture2cxx . . $ Checkers#kingCapture2(2468ecb35c972401).(int,int,int &)=0; |
| 108 | |
| 109 | virtual bool manCapture1cxx . . $ Checkers#manCapture1(a187a828af005c68).(int,int,bool &)=0; |
| 110 | virtual bool kingCapture1cxx . . $ Checkers#kingCapture1(a187a828af005c68).(int,int,bool &)=0; |
| 111 | |
| 112 | int internalcxx . . $ Checkers#internal(7ccb52b1bfe01045).(int) const; // Return internal board position |
| 113 | int externalcxx . . $ Checkers#external(7ccb52b1bfe01045).(int) const; // Return extenal board position |
| 114 | }; |
| 115 | |
| 116 | |
| 117 | #endif |