Add specialized .gitignore

This commit is contained in:
Mattia Giambirtone 2024-04-27 11:12:13 +02:00
parent 4381298957
commit 8eeede55c2
3 changed files with 30 additions and 22 deletions

4
.gitignore vendored
View File

@ -3,7 +3,3 @@ nimcache/
nimblecache/
htmldocs/
bin
Chess/nimfish/nimfishpkg/resources/Pohl.epd
Chess/nimfish/nimfishpkg/resources/*.pgn
# Python
__pycache__

12
Chess/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
# ---> Nim
nimcache/
nimblecache/
htmldocs/
bin
nimfish/nimfishpkg/resources/*.epd
nimfish/nimfishpkg/resources/*.pgn
# Python
__pycache__
fast-chess
log.txt
config.json

View File

@ -198,18 +198,19 @@ proc search(self: SearchManager, depth, ply: int, alpha, beta: Score): Score {.d
## Simple negamax search with alpha-beta pruning
if self.shouldStop():
return
let query = self.transpositionTable.get(self.board.position.zobristKey, depth.uint8)
if query.success:
case query.entry.flag:
of Exact:
return query.entry.score
of LowerBound:
if query.entry.score >= beta:
return query.entry.score
of UpperBound:
if query.entry.score <= alpha:
return query.entry.score
# let query = self.transpositionTable.get(self.board.position.zobristKey, depth.uint8)
# if query.success:
# case query.entry.flag:
# of Exact:
# return query.entry.score
# of LowerBound:
# if query.entry.score >= beta:
# return query.entry.score
# of UpperBound:
# if query.entry.score <= alpha:
# return query.entry.score
if depth == 0:
# Quiescent search gain: 264.8 +/- 71.6
return self.qsearch(0, alpha, beta)
var moves = newMoveList()
var depth = depth
@ -231,13 +232,12 @@ proc search(self: SearchManager, depth, ply: int, alpha, beta: Score): Score {.d
if ply == 0 and self.searchMoves.len() > 0 and move notin self.searchMoves:
continue
self.board.doMove(move)
var extension = self.getSearchExtension(move)
let zobrist = self.board.position.zobristKey
# var extension = self.getSearchExtension(move)
inc(self.nodeCount)
# Find the best move for us (worst move
# for our opponent, hence the negative sign)
var score: Score
var fullDepth = true
#[var fullDepth = true
if extension == 0 and i >= 3 and not move.isCapture():
# Late Move Reduction: assume our move orderer did a good job,
# so it is not worth to look at all moves at the same depth equally.
@ -245,9 +245,9 @@ proc search(self: SearchManager, depth, ply: int, alpha, beta: Score): Score {.d
# it at full depth
const reduction = 1
score = -self.search(depth - 1 - reduction, ply + 1, -beta, -alpha)
fullDepth = score > alpha
if fullDepth:
score = -self.search(depth - 1 + extension, ply + 1, -beta, -alpha)
fullDepth = score > alpha]#
#if fullDepth:
score = -self.search(depth - 1 #[+ extension]#, ply + 1, -beta, -alpha)
if self.board.position.halfMoveClock >= 100 or self.board.position.repetitionDraw:
# Drawing by repetition is *bad*
score = Score(0)
@ -259,7 +259,7 @@ proc search(self: SearchManager, depth, ply: int, alpha, beta: Score): Score {.d
return
bestScore = max(score, bestScore)
let nodeType = if score >= beta: LowerBound elif score <= alpha: UpperBound else: Exact
self.transpositionTable.store(depth.uint8, score, zobrist, nodeType)
# self.transpositionTable.store(depth.uint8, score, self.board.position.zobristKey, nodeType)
if nodeType == LowerBound:
# score >= beta
# This move was too good for us, opponent will not search it