Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,12 @@ int quiescence(int alpha, int beta, board* position, time* time) {
noisyGenerator(moveList, position);

// sort moves
quiescence_sort_moves(moveList, position);
if (moveList->count > 0) {
quiescence_sort_moves(moveList, position);
}




// legal moves counter
//int legal_moves = 0;
Expand Down Expand Up @@ -1026,8 +1031,7 @@ int negamax(int alpha, int beta, int depth, board* pos, time* time, bool cutNode
//captureMoves++;
}

const int new_depth = depth - 1 + extensions;

int new_depth = depth - 1 + extensions;

// full-depth search
if (moves_searched == 0) {
Expand Down Expand Up @@ -1200,6 +1204,7 @@ void searchPosition(int depth, board* position, bool benchmark, time* time) {
position->scorePv = 0;

memset(position->killerMoves, 0, sizeof(position->killerMoves));
//memset(position->mailbox, NO_PIECE, sizeof(position->mailbox));
memset(quietHistory, 0, sizeof(quietHistory));
memset(rootHistory, 0, sizeof(rootHistory));
memset(pawnCorrectionHistory, 0, sizeof(pawnCorrectionHistory));
Expand Down
2 changes: 0 additions & 2 deletions src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <stdint.h>
#include "utils.h"

#define maxPly 64

extern int lmr_full_depth_moves;
extern int lmr_reduction_limit;
extern int lateMovePruningBaseReduction;
Expand Down
2 changes: 1 addition & 1 deletion src/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define U64 unsigned long long
#endif

#define maxPly 64
#define maxPly 256

typedef struct {
U64 bitboards[12];
Expand Down
30 changes: 19 additions & 11 deletions src/uci.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,20 @@ void communicate(time* time) {


void uciProtocol(int argc, char *argv[]) {
board position;
board *position = (board *)malloc(sizeof(board));

time time;
position->ply = 0;

for (int i = 0; i < 64;i++) {
position->mailbox[i] = NO_PIECE;
}

clearStaticEvaluationHistory(position);

time *time_ctrl = (time *)malloc(sizeof(time));

// init time control
initTimeControl(&time);
initTimeControl(time_ctrl);

// max hash MB
int max_hash = 32768;
Expand All @@ -400,7 +408,7 @@ void uciProtocol(int argc, char *argv[]) {

if (argc >= 2 && strncmp(argv[1], "bench", 5) == 0) {
printf("bench running..\n");
benchmark(14, &position, &time);
benchmark(14, position, time_ctrl);
return;
}

Expand Down Expand Up @@ -434,7 +442,7 @@ void uciProtocol(int argc, char *argv[]) {
else if (strncmp(input, "position", 8) == 0)
{
// call parse position function
parse_position(input, &position);
parse_position(input, position);

// clear hash table
clearHashTable();
Expand All @@ -443,7 +451,7 @@ void uciProtocol(int argc, char *argv[]) {
clearQuietHistory();

//clear static eval history
clearStaticEvaluationHistory(&position);
clearStaticEvaluationHistory(position);

//clear counter moves
clearCounterMoves();
Expand All @@ -452,7 +460,7 @@ void uciProtocol(int argc, char *argv[]) {
else if (strncmp(input, "ucinewgame", 10) == 0)
{
// call parse position function
parse_position("position startpos", &position);
parse_position("position startpos", position);

// clear hash table
clearHashTable();
Expand All @@ -461,15 +469,15 @@ void uciProtocol(int argc, char *argv[]) {
clearQuietHistory();

//clear static eval history
clearStaticEvaluationHistory(&position);
clearStaticEvaluationHistory(position);

//clear counter moves
clearCounterMoves();
}
// parse UCI "go" command
else if (strncmp(input, "go", 2) == 0) {
// call parse go function
goCommand(input, &position, &time);
goCommand(input, position, time_ctrl);

// clear hash table
clearHashTable();
Expand All @@ -478,7 +486,7 @@ void uciProtocol(int argc, char *argv[]) {
clearQuietHistory();

//clear static eval history
clearStaticEvaluationHistory(&position);
clearStaticEvaluationHistory(position);

//clear counter moves
clearCounterMoves();
Expand Down Expand Up @@ -515,7 +523,7 @@ void uciProtocol(int argc, char *argv[]) {
printf("uciok\n");
}
else if (strncmp(input, "bench", 5) == 0) {
benchmark(14, &position, &time);
benchmark(14, position, time_ctrl);
}
}
}