forked from sshivaji/stockfish-mac-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChessPosition.h
86 lines (72 loc) · 2.75 KB
/
ChessPosition.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
Stockfish, a OS X GUI for the UCI chess engine with the same name.
Copyright (C) 2004-2011 Marco Costalba, Joona Kiiski, Tord Romstad
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import <Cocoa/Cocoa.h>
#import "position.h"
@class ChessMove;
@interface ChessPosition : NSObject {
position_t pos[1];
}
+(BOOL)looksLikeAFENString:(NSString *)string;
+(id)initialPosition;
+(id)positionAfterMakingMove:(ChessMove *)move
fromPosition:(ChessPosition *)position;
+(NSString *)fenFromFRCid:(int)FRCid;
+(id)positionWithFRCid:(int)FRCid;
-(id)initWithFEN:(NSString *)fen;
-(id)init;
-(NSString *)FENString;
-(NSString *)description;
-(void)display;
-(NSString *)moveToSAN:(NSString *)moveString;
-(NSString *)lineToSAN:(NSString *)lineString moveNumbers:(BOOL)moveNums;
-(NSString *)lineToSAN:(NSString *)lineString;
-(ChessMove *)parseSANMove:(NSString *)str;
-(ChessMove *)parseCoordinateMove:(NSString *)str;
-(position_t *)pos;
-(uint64_t)hashkey;
-(int)pieceAtSquare:(int)squareIndex;
-(BOOL)whiteToMove;
-(int)moveNumber;
-(ChessMove *)generateMoveFrom:(int)from to:(int)to
promotion:(int)promotion;
-(ChessMove *)generateMoveFrom:(int)from to:(int)to;
-(int)countLegalMoves;
-(BOOL)moveFrom:(int)from to:(int)to promotion:(int)promotion;
-(BOOL)moveFrom:(int)from to:(int)to;
-(void)makeMove:(ChessMove *)move;
-(void)destinationSquaresFrom:(int)sqIndex storeIn:(int *)sqArray;
-(BOOL)isEqualToPosition:(ChessPosition *)aPosition;
-(BOOL)isMate;
-(BOOL)isRule50Draw;
-(BOOL)isRepetitionDraw;
-(BOOL)isMaterialDraw;
-(BOOL)isStalemate;
-(BOOL)isDraw;
-(BOOL)isTerminal;
-(BOOL)whiteCanCastleKingside;
-(BOOL)whiteCanCastleQueenside;
-(BOOL)blackCanCastleKingside;
-(BOOL)blackCanCastleQueenside;
-(BOOL)sideToMoveCanCastleKingsideImmediately;
-(BOOL)sideToMoveCanCastleQueensideImmediately;
-(ChessMove *)generateOO;
-(ChessMove *)generateOOO;
-(NSString *)UCIStringFromOOMove:(ChessMove *)move;
-(NSString *)UCIStringFromOOOMove:(ChessMove *)move;
// USE THE FOLLOWING FUNCTIONS ONLY IF YOU REALLY KNOW WHAT YOU'RE DOING!
// They will usually leave the position object in an inconsistent state.
-(void)putPiece:(int)piece atSquare:(int)squareIndex;
-(void)removePieceAtSquare:(int)squareIndex;
@end