bsamseth / Goldfish

Goldfish - Stockfish's very distant and not so bright cousin - a UCI chess engine
MIT License
7 stars 2 forks source link

Pawn evaluation #28

Closed bsamseth closed 3 months ago

bsamseth commented 5 years ago

Try to make the evaluation consider pawns in a smart way.

bsamseth commented 5 years ago

The essential change here is this function. The rest is just to facilitate this code. For each pawn on the board of a given color we compute a value based on how we can classify the pawn (passed, connected, backwards, doubled or isolated).

https://github.com/bsamseth/Goldfish/blob/5a934e3788228994c30724417632e8147457f721/src/evaluation.cpp#L107-L149

With the following total weight set: https://github.com/bsamseth/Goldfish/blob/5a934e3788228994c30724417632e8147457f721/src/evaluation.cpp#L5-L8

bsamseth commented 5 years ago

Benchmark results are quite interesting. The number of nodes searched goes down by a good bit, indicating the it can now differenciate positions it could not before, and that this in turn leads to more oppertunities for cutoffs during the search. Still, the nodes/second score goes down a bit as well, which is to be expected.

Reported results are from 10 bench runs (benchmark.py), but run on my laptop, which makes the time scores quite unstable, but still possible to consider.

New

Times (ms): [6739, 6786, 6879, 6912, 6986, 7075, 7087, 7152] Average: 6.9520e+03 Std: 1.3891e+02 CI 95%: [6.6797e+03, 7.2243e+03] Nodes constant: TRUE Nodes: 6621254 Nodes/second: 9.5242e+02 CI 95%: [9.9124e+02, 9.1653e+02]

Master

Times (ms): [6344, 6348, 6559, 6601, 6652, 6665, 6690, 6968] Average: 6.6034e+03 Std: 1.8744e+02 CI 95%: [6.2360e+03, 6.9708e+03] Nodes constant: TRUE Nodes: 7193743 Nodes/second: 1.0894e+03 CI 95%: [1.1536e+03, 1.0320e+03]

codecov[bot] commented 5 years ago

Codecov Report

Merging #28 into master will increase coverage by 0.21%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   90.67%   90.89%   +0.21%     
==========================================
  Files          31       31              
  Lines        1459     1505      +46     
==========================================
+ Hits         1323     1368      +45     
- Misses        136      137       +1
Impacted Files Coverage Δ
include/bitboard.hpp 100% <ø> (ø) :arrow_up:
include/file.hpp 100% <100%> (ø) :arrow_up:
src/evaluation.cpp 100% <100%> (ø) :arrow_up:
include/square.hpp 100% <100%> (ø) :arrow_up:
include/rank.hpp 100% <100%> (ø) :arrow_up:
src/search.cpp 96.62% <0%> (-0.68%) :arrow_down:
include/value.hpp 62.5% <0%> (+5.35%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 07030c5...6b16e37. Read the comment docs.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.2%) to 91.818% when pulling 200138b66455e4a725fa7cc927ea3e85ec4d403c on pawn-evaluation into 07030c51d30a2576da11c8cc98d9577f5bc32c70 on master.