Fix rebase nonsense

This commit is contained in:
Mattia Giambirtone 2024-05-19 01:40:41 +02:00
parent 24ad374df7
commit a44966143d
No known key found for this signature in database
GPG Key ID: 37B83AB6C3BE6514
2 changed files with 3 additions and 29 deletions

6
Chess/.gitignore vendored
View File

@ -11,8 +11,8 @@ __pycache__
*.log
venv/
*.so
pyvenv.cfg
lib
lib64
lib/
lib64/
share
*.json
pyvenv.cfg

View File

@ -346,19 +346,11 @@ proc evaluate*(position: Position, mode: static EvalMode, features: Features = F
middleGameScores[piece.color] += MIDDLEGAME_VALUE_TABLES[piece.color][piece.kind][sq]
endGameScores[piece.color] += ENDGAME_VALUE_TABLES[piece.color][piece.kind][sq]
else:
<<<<<<< HEAD
features.psqts[piece.kind][sq].mg = scaledMiddleGame
features.psqts[piece.kind][sq].eg = scaledEndGame
features.pieceWeights[piece.kind].mg += MIDDLEGAME_WEIGHTS[piece.kind].float
features.pieceWeights[piece.kind].eg += ENDGAME_WEIGHTS[piece.kind].float
# Final score computation
=======
features.psqts[piece.kind][sq].mg = scaledMiddleGame * (if piece.color == Black: -1 else: 1)
features.psqts[piece.kind][sq].eg = scaledEndGame * (if piece.color == Black: -1 else: 1)
features.pieceWeights[piece.kind].mg += (if piece.color == Black: -1.0 else: 1.0) * scaledMiddleGame
features.pieceWeights[piece.kind].eg += (if piece.color == Black: -1.0 else: 1.0) * scaledEndGame
# Final score computation
>>>>>>> 54c7cda (Experiment with razoring and fix various tuner issues)
let
middleGameScore = middleGameScores[sideToMove] - middleGameScores[nonSideToMove]
endGameScore = endGameScores[sideToMove] - endGameScores[nonSideToMove]
@ -497,15 +489,6 @@ proc extract*(self: Features, fen: string): Tensor[float] =
var position = loadFEN(fen)
result = newTensor[float](1, self.featureCount())
discard position.evaluate(EvalMode.Tune, self)
<<<<<<< HEAD
# IMPORTANT NOTE: Features is a reference type, so the internal
# metadata is NOT reset at every call to extract()! This is why
# we only take the values from the current position's occupancy
# rather than the entire thing, we would be taking garbage from
# previous feature extractions if we just iterated over every piece
# on every square
=======
>>>>>>> 54c7cda (Experiment with razoring and fix various tuner issues)
for square in position.getOccupancy():
let piece = position.getPiece(square)
var idx = piece.kind.int * len(self.psqts[piece.kind]) + square.int
@ -514,14 +497,6 @@ proc extract*(self: Features, fen: string): Tensor[float] =
# Skip to the first endgame entry
idx += 64 * 6
result[0, idx] = self.psqts[piece.kind][square].eg
<<<<<<< HEAD
# Skip to the first middle-game piece weight entry
idx = (64 * 6) * 2
result[0, idx] = self.pieceWeights[piece.kind].mg
# Skip to the first end-game piece weight entry
idx += 6 * 2
result[0, idx] = self.pieceWeights[piece.kind].eg
=======
# Skip the piece-square tables
let offset = 64 * 6 * 2
@ -531,7 +506,6 @@ proc extract*(self: Features, fen: string): Tensor[float] =
# Skip to the first end-game piece weight entry
idx += 6
result[0, idx] = self.pieceWeights[kind].eg
>>>>>>> 54c7cda (Experiment with razoring and fix various tuner issues)
result[0, ^1] = self.tempo