-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzobrist.h
31 lines (24 loc) · 880 Bytes
/
zobrist.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 ZOBRIST_H
#define ZOBRIST_H
#include <array>
#include <stdlib.h>
#include "board.h"
#include "constants.h"
class ZobristNums {
uint64_t zobristNums[NumColors][NumPieces][NumSquares];
ZobristNums();
public:
// singleton pattern (exciting!!), where we enforce only one object created, and destroy copy ctors
static ZobristNums& getZobrist() {
static ZobristNums instance;
return instance;
}
ZobristNums(const ZobristNums& other) = delete;
void operator=(const ZobristNums& other) = delete;
static uint64_t newPosition();
static void changePiece(uint64_t& hash, Color pieceColor, Piece pieceType, Square pieceLocation);
static void flipColor(uint64_t& hash);
static void changeCastleRights(uint64_t& hash, Color side, bool isKingside);
static void changeEnPassant(uint64_t& hash, Index file);
};
#endif