Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Initialize network before calling evaluation in tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
mhib committed Oct 10, 2021
1 parent 3e7fd0a commit 77cd0e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tuning/trace_tune.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ func (tuner *traceTuner) parseTraceEntry(t *thread, fen string) (traceEntry, boo
board = child
}
T = Trace{}
res.eval = float64((&EvaluationContext{}).Evaluate(&board))
var ec EvaluationContext
ec.Initialize(&board)
res.eval = float64(ec.Evaluate(&board))

res.scale = T.Scale
if board.SideToMove == Black {
Expand Down
8 changes: 6 additions & 2 deletions tuning/tuning.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ func (t *thread) quiescence(alpha, beta, height int, inCheck bool) int {

moveCount := 0

val := (&EvaluationContext{}).Evaluate(pos)
var ec EvaluationContext
ec.Initialize(pos)
val := ec.Evaluate(pos)

var evaled []EvaledMove
if inCheck {
Expand Down Expand Up @@ -193,7 +195,9 @@ func (t *tuner) computeError(entriesCount int) float64 {
var c, sum float64
for y := idx; y < entriesCount; y += numCPU {
entry := t.entries[y]
evaluation := float64((&EvaluationContext{}).Evaluate(&entry.Position))
var ec EvaluationContext
ec.Initialize(&entry.Position)
evaluation := float64(ec.Evaluate(&entry.Position))
if entry.Position.SideToMove == Black {
evaluation *= -1
}
Expand Down

0 comments on commit 77cd0e7

Please sign in to comment.