-
Notifications
You must be signed in to change notification settings - Fork 1
/
engine.h
executable file
·90 lines (71 loc) · 2.66 KB
/
engine.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#pragma once
#include "enum.h"
#include "position.h"
#include "move.h"
#include <string>
#include <fstream>
#include <vector>
class engine
{
public:
//position
position Position;
//timing info
int SearchStarted;
int NodesSearched;
int SearchTime;
int GameTime;
int CompColor;
int HorizonDepth;
bool Output;
//transposition table
pos_info TranspositionTable[ TRANSPOSITION_TABLE_SIZE ];
int ProbeHash(int Depth, int Alpha, int Beta, std::vector<move>& Line);
void RecordHash(int Depth, int Val, int HashF, move& Move);
move GetTableMove();
void DeleteBoardFromTable();
bitboard ProbeMoveStorage( int Color, int Type, int From, bitboard Board );
void RecordMoveStorage( int Color, int Type, int From, bitboard Board, bitboard MoveBoard );
//xboard command handler
void ProcessCommand( std::string Command );
bool Post;
//make a move
bool MakeMove( int From, int To, int Turn, int Promotion );
//search for a move
move MakeBestMove( color Color, int Time, bool Output );
void Ponder( color Color );
int SEE( move& Move, int KillType );
int AlphaBeta( int Alpha, int Beta, int RemDepth, std::vector<move>& Line );
int Quiescent(int Alpha, int Beta);
//generate moves
void GenMoves( std::vector<move>& Moves, int& Count, bool CapturesOnly = false );
bitboard GenAllAttackBitboards( int Color );
bitboard GenMoveBitboard( int Color, int Type, int Location );
bitboard GenAttackBitoard( int Color, int Type, int Location );
void GenWhitePawnMoveBitboard( int Location, bitboard EnemyPieces, bitboard AllPieces, bitboard& Moves );
void GenBlackPawnMoveBitboard( int Location, bitboard EnemyPieces, bitboard AllPieces, bitboard& Moves );
void GenKingMoveBitboard( int Color, int Location, bitboard EnemyPieces, bitboard AllPieces, bitboard& Moves, bitboard Attacks );
void GenRookMoveBitboard( int Location, bitboard EnemyPieces, bitboard AllPieces, bitboard& Moves );
void GenBishopMoveBitboard( int Location, bitboard EnemyPieces, bitboard AllPieces, bitboard& Moves );
void GenWhitePawnAttackBitboard( int Location, bitboard& Moves );
void GenBlackPawnAttackBitboard( int Location, bitboard& Moves );
//notation handler
std::string NotateMove( move& Move, position& Position );
std::string NotateMove( move& Move );
//handle searching and pondering
void StartPonder();
void TerminatePonder();
void StartSearch();
void TerminateSearch();
bool SearchTerminated;
bool Searching;
//test suite
void TestSuite( std::string Path, int Time );
//logging
std::ofstream lout;
//constructor
engine( std::string FEN );
engine();
//util
std::string ShowPieceIds();
};