-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcompassrose.h
executable file
·32 lines (28 loc) · 1.38 KB
/
compassrose.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
#ifndef COMPASSROSE_H
#define COMPASSROSE_H
#include "constants.h"
namespace Napoleon
{
namespace CompassRose
{
/* northwest north northeast
noWe nort noEa
+7 +8 +9
\ | /
west -1 <- 0 -> +1 east
/ | \
-9 -8 -7
soWe sout soEa
southwest south southeast
*/
INLINE static BitBoard OneStepSouth(BitBoard bitBoard) { return bitBoard >> 8; }
INLINE static BitBoard OneStepNorth(BitBoard bitBoard) { return bitBoard << 8; }
INLINE static BitBoard OneStepWest(BitBoard bitBoard) { return bitBoard >> 1 & Constants::NotHFile; }
INLINE static BitBoard OneStepEast(BitBoard bitBoard) { return bitBoard << 1 & Constants::NotAFile; }
INLINE static BitBoard OneStepNorthEast(BitBoard bitBoard) { return bitBoard << 9 & Constants::NotAFile; }
INLINE static BitBoard OneStepNorthWest(BitBoard bitBoard) { return bitBoard << 7 & Constants::NotHFile; }
INLINE static BitBoard OneStepSouthEast(BitBoard bitBoard) { return bitBoard >> 7 & Constants::NotAFile; }
INLINE static BitBoard OneStepSouthWest(BitBoard bitBoard) { return bitBoard >> 9 & Constants::NotHFile; }
}
}
#endif // COMPASSROSE_H