Add specialized .gitignore

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

4
.gitignore vendored
View File

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