-
Notifications
You must be signed in to change notification settings - Fork 0
/
surakartareason.h
40 lines (34 loc) · 1.72 KB
/
surakartareason.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
#ifndef SURAKARTAREASON_H
#define SURAKARTAREASON_H
#include <iostream>
enum class SurakartaIllegalMoveReason {
LEGAL, // unused
LEGAL_CAPTURE_MOVE, // capture a opponent's piece, and the move consists at least one corner loop
LEGAL_NON_CAPTURE_MOVE, // just as the name
ILLIGAL, // unused
NOT_PLAYER_TURN, // move when it's not the player's turn.
OUT_OF_BOARD, // from or to position is out of board
NOT_PIECE, // move a position that is not a piece
NOT_PLAYER_PIECE, // move a piece that is not the player's
ILLIGAL_CAPTURE_MOVE, // try to capture a opponent's piece, but the move can't consist any corner loop
ILLIGAL_NON_CAPTURE_MOVE, // otherwise
GAME_ALREADY_END, // unused
GAME_NOT_START, // unused
TIMEOUT
};
enum class SurakartaEndReason {
NONE, // not end
STALEMATE, // both players can't make more move
CHECKMATE, // one player's all pieces are captured
TRAPPED, // unused, one player's pieces are all trapped, no legal move can be made.
RESIGN, // one player resigns.
TIMEOUT, // one player's time is out.
ILLIGAL_MOVE, // one player makes an illegal move
};
bool IsLegalMoveReason(SurakartaIllegalMoveReason reason);
bool IsEndReason(SurakartaEndReason reason);
std::ostream& operator<<(std::ostream& os, const SurakartaIllegalMoveReason& reason);
std::istream& operator>>(std::istream& is, SurakartaIllegalMoveReason& reason);
std::ostream& operator<<(std::ostream& os, const SurakartaEndReason& reason);
std::istream& operator>>(std::istream& is, SurakartaEndReason& reason);
#endif // SURAKARTAREASON_H