Kayra 1.2:

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

Eduard
Posts: 1439
Joined: Sat Oct 27, 2018 12:58 am
Location: Germany
Full name: N.N.

Re: Kayra 1.2:

Post by Eduard »

Kayra 1.5 TDI-Engine:

I modified Kayra 1.5 and adjusted scaling (1064 + 106) to the "nn-ad9b42354671.nnue" network. Some parameters have been changed with my TDI style, so the engine plays more aggressively and with more dynamics. There are 3 compiles 64-Bit: AVX2, BMI2 and SSE41.

Downloads:
https://filehorst.de/d/eyvkiChF

If someone wants to put an alternative download link and in another forum, you are welcome.

Have fun testing!

solista@web.de
Eduard
User avatar
Sylwy
Posts: 4753
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: Kayra 1.2:

Post by Sylwy »

Eduard wrote: Wed Aug 17, 2022 12:19 am Kayra 1.5 TDI-Engine:

I modified Kayra 1.5 and adjusted scaling (1064 + 106) to the "nn-ad9b42354671.nnue" network. Some parameters have been changed with my TDI style, so the engine plays more aggressively and with more dynamics. There are 3 compiles 64-Bit: AVX2, BMI2 and SSE41.

Downloads:
https://filehorst.de/d/eyvkiChF

If someone wants to put an alternative download link and in another forum, you are welcome.

Have fun testing!

solista@web.de
Eduard
Thank you !
mehmet123
Posts: 676
Joined: Sun Jan 26, 2020 10:38 pm
Location: Turkey
Full name: Mehmet Karaman

Re: Kayra 1.2:

Post by mehmet123 »

mehmet123
Posts: 676
Joined: Sun Jan 26, 2020 10:38 pm
Location: Turkey
Full name: Mehmet Karaman

Re: Kayra 1.2:

Post by mehmet123 »

mehmet123
Posts: 676
Joined: Sun Jan 26, 2020 10:38 pm
Location: Turkey
Full name: Mehmet Karaman

Re: Kayra 1.2:

Post by mehmet123 »

Some differences between Kayra and Stockfish:

Kayra 1.6 was released at 20/09/22. I only added only one Stockfish patch to Kayra 1.7 (Adjust timeman constants).
This patch is only effective at dead time control matches
https://github.com/official-stockfish/S ... 22359effa0


I tried to make the comparison according to Stockfish 170921 as the differences increased significantly due to the addition of many patches to Stockfish in the last 2 months


enum NodeType { NonPV, PV, Root };

+ const int RazorBound[9] = {1149, 2271, 4477, 6432, 6849, 7188, 7421, 7724, 7945};


+ if ( !PvNode

&& depth <= 7

- && eval < alpha - 369 - 254 * depth * depth)
+ && eval < alpha - 19 - RazorBound[depth - 1])


if (ttCapture)

r++;

+ if ( !ss->inCheck

+ && !PvNode

+ && ttCapture

+ && !(capture || givesCheck)

+ && ss->staticEval < beta - 198 * depth)

+ r++;


// History and stats update bonus, based on depth
int stat_bonus(Depth d) {
- return std::min((12 * d + 282) * d - 349 , 1594);

+ return std::min(d < 10 ? 249 * d - 198 : 13 * d + 1898, 3459);

+ {

// Increase stats for the best move in case it was a capture move
- captureHistory[moved_piece][to_sq(bestMove)][captured] << bonus1;

+ int bonus = (captureCount || captureHistory[moved_piece][to_sq(bestMove)][captured] <= 0) ? bonus1 : stat_bonus(depth);
+ captureHistory[moved_piece][to_sq(bestMove)][captured] << bonus;
+ }

// Null move dynamic reduction based on depth, eval and complexity of position
- Depth R = std::min(int(eval - beta) / 168, 7) + depth / 3 + 4 - (complexity > 861);

+ Depth R = std::min(int(eval - beta) / 155, 7) + depth / 3 + 4 - (complexity > 792);



thisThread->nmpMinPly = 0;

if (v >= beta)
+ {
return nullValue;
+ update_continuation_histories(ss, pos.moved_piece(ss->currentMove), to_sq(ss->currentMove), stat_bonus(depth-R));
return nullValue;

+ }
}
}


Search. h:

+ bool exCapture;
int doubleExtensions;
int cutoffCnt;
};


ss->currentMove = MOVE_NULL;
+ ss->exCapture = false;
ss->continuationHistory = &thisThread->continuationHistory[0][0][NO_PIECE][0];


ss->currentMove = move;
+ ss->exCapture = pos.captured_piece();
ss->continuationHistory = &thisThread->continuationHistory[ss->inCheck]
[

- r -= ss->statScore / 13628;

+ r -= (ss->statScore + 2440 * cutNode) / 15244;


if ( !rootNode

- && depth >= 4 - (thisThread->previousDepth > 24) + 2 * (PvNode && tte->is_pv())

+ && depth >= 5 + cutNode + 2 * (PvNode && tte->is_pv())- (complexity > 192)


- && eval >= ss->staticEval

+ && eval >= ss->staticEval – 75

- && && ss->staticEval >= beta - 20 * depth - improvement / 13 + 233 + complexity / 25

+ && ss->staticEval >= beta - 20 * depth - improvement / 15 + 198 + complexity / 8


int r = Reductions[d] * Reductions[mn];

- return (r + 1642 - int(delta) * 1024 / int(rootDelta)) / 1024 + (!i && r > 916);

+ return (r + 1542 - int(delta) * 1024 / int(rootDelta)) / 1024 + (!i && r > 969);


return std::min((12 * d + 282) * d - 349 , 1594);

+ return std::min(d < 10 ? 249 * d - 198 : 13 * d + 1898, 3459);


- Reductions = int((20.26 + std::log(Threads.size()) / 2) * std::log(i));
+ Reductions = int((20.34 + std::log(Threads.size()) / 2) * std::log(i));



Value prev = rootMoves[pvIdx].averageScore;

- delta = Value(10) + int(prev) * prev / 15620;

+ delta = Value(13) + int(prev) * prev / 14962;


// Adjust trend and optimism based on root move's previousScore
+ int tr = 122 * prev / (std::abs(prev) + 85);
+ trend = (us == WHITE ? make_score(tr, tr / 2)
: -make_score(tr, tr / 2));

- int opt = 118 * prev / (std::abs(prev) + 169);
+ int opt = 111 * prev / (std::abs(prev) + 169);
optimism[ us] = Value(opt);
optimism[~us] = -optimism[us];



- delta += delta / 4 + 3;

+ delta += delta / 4 + 3;



- double fallingEval = (71 + 12 * (mainThread->bestPreviousAverageScore - bestValue)

+ 6 * (mainThread->iterValue[iterIdx] - bestValue)) / 656.7;

+ double fallingEval = (69 + 12 * (mainThread->bestPreviousAverageScore - bestValue)
+ 6 * (mainThread->iterValue[iterIdx] - bestValue)) / 657.2;
fallingEval = std::clamp(fallingEval, 0.5, 1.5);

- && Time.elapsed() > totalTime * 0.53)

+ & Time.elapsed() > totalTime * 0.51)



- int bonus = std::clamp(-19 * int((ss-1)->staticEval + ss->staticEval), -1914, 1914);

+ int bonus = std::clamp(-19 * int((ss-1)->staticEval + ss->staticEval), -1977, 1977);


- complexityAverage.set(155, 1);

+ complexityAverage.set(154, 1);


improvement = (ss-2)->staticEval != VALUE_NONE ? ss->staticEval - (ss-2)->staticEval

: (ss-4)->staticEval != VALUE_NONE ? ss->staticEval - (ss-4)->staticEval

- : 168;
+ : 185;



if ( !ss->ttPv

&& depth < 8

- && eval - futility_margin(depth, improving) - (ss-1)->statScore / 303 >= beta

+ && eval - futility_margin(depth, improving) - (ss-1)->statScore / 272 >= beta



&& eval >= beta

- && eval < 28031)

+ && eval < 24692)

return eval;



if ( !PvNode

&& (ss-1)->currentMove != MOVE_NULL

- && (ss-1)->statScore < 17139

+ && (ss-1)->statScore < 15804


&& eval >= beta

- && eval >= ss->staticEval

+ && eval >= ss->staticEval - 75

- && ss->staticEval >= beta - 20 * depth - improvement / 13 + 233 + complexity / 25

+ && ss->staticEval >= beta - 19 * depth - improvement / 15 + 144 + complexity / 8



- Depth R = std::min(int(eval - beta) / 168, 7) + depth / 3 + 4 - (complexity > 861);

+ Depth R = std::min(int(eval - beta) / 155, 7) + depth / 3 + 4 - (complexity > 792);


- probCutBeta = beta + 191 - 54 * improving;

+ probCutBeta = beta + 179 - 45 * improving;



- probCutBeta = beta + 417;

+ probCutBeta = beta + 444;

if ( ss->inCheck



&& lmrDepth < 7

&& !ss->inCheck

- && ss->staticEval + 180 + 201 * lmrDepth + PieceValue[EG][pos.piece_on(to_sq(move))]

+ && ss->staticEval + 249 + 172 * lmrDepth + PieceValue[EG][pos.piece_on(to_sq(move))]
+ captureHistory[movedPiece][to_sq(move)][type_of(pos.piece_on(to_sq(move)))] / 6 < alpha)
continue;



- if (!pos.see_ge(move, Value(-222) * depth))

+ if (!pos.see_ge(move, Value(-214) * depth))

continue;



if ( lmrDepth < 5

- && history < -3875 * (depth - 1))

+ && history < -3825 * (depth - 1))

continue;


if ( !ss->inCheck

- && lmrDepth < 13

+ && lmrDepth < 12

- && ss->staticEval + 106 + 145 * lmrDepth + history / 52 <= alpha)

+ && ss->staticEval + 132 + 129 * lmrDepth + history / 48 <= alpha)

continue;


// Prune moves with negative SEE (~3 Elo)

continue;

- if (!pos.see_ge(move, Value(-24 * lmrDepth * lmrDepth - 15 * lmrDepth)))

+ if (!pos.see_ge(move, Value(-24 * lmrDepth * lmrDepth - 18 * lmrDepth)))

continue;


if ( !PvNode

- && value < singularBeta – 25

+ && value < singularBeta - 79)

extension = 2;

&& ss->doubleExtensions <= 9)



else if ( givesCheck

&& depth > 9

- && abs(ss->staticEval) > 82)

+ && abs(ss->staticEval) > 85)

extension = 1;



- && (*contHist[0])[movedPiece][to_sq(move)] >= 5177)

+ && (*contHist[0])[movedPiece][to_sq(move)] >= 5021)



ss->statScore = 2 * thisThread->mainHistory[us][from_to(move)]

+ (*contHist[0])[movedPiece][to_sq(move)]

+ (*contHist[1])[movedPiece][to_sq(move)]

+ (*contHist[3])[movedPiece][to_sq(move)]

- 4433;

+ 4285;


- const bool doDeeperSearch = value > (alpha + 64 + 11 * (newDepth - d));

+ const bool doDeeperSearch = value > (alpha + 66 + 12 * (newDepth - d));

value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch, !cutNode);


bool extraBonus = PvNode

|| cutNode

- || bestValue < alpha - 62 * depth;

+ || bestValue < alpha – 74 * depth;


if (PvNode && bestValue > alpha)

alpha = bestValue;

- futilityBase = bestValue + 153;

+ futilityBase = bestValue + 151;


bool useClassical = !useNNUE ||

((pos.count<ALL_PIECES>() > 7)

- && abs(psq) * 5 > (856 + pos.non_pawn_material() / 64) * (10 + pos.rule50_count()));

+ && abs(psq) * 5 > (844 + pos.non_pawn_material() / 64) * (10 + pos.rule50_count()));



int nnueComplexity;

- int scale = 1064 + 106 * pos.non_pawn_material() / 5120;

+ int scale = 1089 + 104 * pos.non_pawn_material() / 5092;

Value optimism = pos.this_thread()->optimism[stm];



Value nnue = NNUE::evaluate(pos, true, &nnueComplexity);

- nnueComplexity = (104 * nnueComplexity + 131 * abs(nnue - psq)) / 256;

+ nnueComplexity = (102 * nnueComplexity + 139 * abs(nnue - psq)) / 262;

if (complexity) // Return hybrid NNUE complexity to caller

*complexity = nnueComplexity;



- optimism = optimism * (269 + nnueComplexity) / 256;

+ optimism = optimism * (262 + nnueComplexity) / 256;



- v = (nnue * scale + optimism * (scale - 754)) / 1024;

+ v = (nnue * scale + optimism * (scale - 769)) / 992;



- v = v * (195 - pos.rule50_count()) / 211;

+ v = v * (189 - pos.rule50_count()) / 208;