-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove.h
More file actions
36 lines (31 loc) · 634 Bytes
/
move.h
File metadata and controls
36 lines (31 loc) · 634 Bytes
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
#ifndef MOVE_H
#define MOVE_H
#include <cstdint>
#include <string>
typedef uint16_t Move;
namespace MoveEncoder
{
inline Move encode(int from, int to, int flag)
{
return from | (to << 6) | (flag << 12);
}
inline int getFrom(Move m)
{
return m & 0x3F;
}
inline int getTo(Move m)
{
return (m >> 6) & 0x3F;
}
inline int getFlag(Move m)
{
return (m >> 12) & 0xF;
}
const int QUIET = 0;
const int PROMO_KNIGHT = 1;
const int PROMO_BISHOP = 2;
const int PROMO_ROOK = 3;
const int PROMO_QUEEN = 4;
const int EN_PASSANT = 5;
}
#endif