-
Notifications
You must be signed in to change notification settings - Fork 0
/
move.h
31 lines (25 loc) · 804 Bytes
/
move.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
#ifndef MOVE_H
#define MOVE_H
#include <string>
#include "bitboard.h"
#define NEW_MOVE(source, dest, castle, promote, isEp) (isEp | ((promote) << 1) | ((castle) << 4) | ((dest) << 6) | ((source) << 12))
#define SOURCE(move) (((move) >> 12) & 0b111111)
#define DEST(move) (((move) >> 6) & 0b111111)
// 1 = short, 2 = long
#define CASTLE(move) (((move) >> 4) & 0b11)
#define PROMOTE(move) (((move) >> 1) & 0b111)
#define IS_EP(move) ((move) & 0b1)
namespace move {
struct Move {
int source;
int dest;
int castle;
int promote;
bool isEp;
};
std::string to_string(int move);
int uci_to_move(const bitboard::Position &board, std::string uci);
int uci_to_move(const bitboard::Position &board, int from, int dest, int promote);
void make_move(bitboard::Position &board, int move);
}
#endif