Skip to content

Commit f3a2296

Browse files
mstemberasnicolet
authored andcommitted
Small cleanups (2)
- fix a small compile error under MSVC - improve sigmoid comment and assert - fix formatting in README.md closes #3960 No functional change
1 parent 004ea2c commit f3a2296

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed

README.md

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,28 @@ Cute Chess, eboard, Arena, Sigma Chess, Shredder, Chess Partner or Fritz) in ord
1010
to be used comfortably. Read the documentation for your GUI of choice for information
1111
about how to use Stockfish with it.
1212

13-
The Stockfish engine features two evaluation functions for chess.
14-
The efficiently updatable neural network (NNUE) based evaluation is the default and by far the strongest.
15-
The classical evaluation based on handcrafted terms remains available.
16-
The strongest network is integrated in the binary and downloaded automatically during the build process.
17-
The NNUE evaluation benefits from the vector intrinsics available on most CPUs (sse2, avx2, neon, or similar).
13+
The Stockfish engine features two evaluation functions for chess. The efficiently
14+
updatable neural network (NNUE) based evaluation is the default and by far the strongest.
15+
The classical evaluation based on handcrafted terms remains available. The strongest
16+
network is integrated in the binary and downloaded automatically during the build process.
17+
The NNUE evaluation benefits from the vector intrinsics available on most CPUs (sse2,
18+
avx2, neon, or similar).
1819

1920
## Files
2021

2122
This distribution of Stockfish consists of the following files:
2223

23-
* [Readme.md](https://github.com/official-stockfish/Stockfish/blob/master/README.md), the file you are currently reading.
24+
* [Readme.md](https://github.com/official-stockfish/Stockfish/blob/master/README.md),
25+
the file you are currently reading.
2426

25-
* [Copying.txt](https://github.com/official-stockfish/Stockfish/blob/master/Copying.txt), a text file containing the GNU General Public License version 3.
27+
* [Copying.txt](https://github.com/official-stockfish/Stockfish/blob/master/Copying.txt),
28+
a text file containing the GNU General Public License version 3.
2629

27-
* [AUTHORS](https://github.com/official-stockfish/Stockfish/blob/master/AUTHORS), a text file with the list of authors for the project
30+
* [AUTHORS](https://github.com/official-stockfish/Stockfish/blob/master/AUTHORS),
31+
a text file with the list of authors for the project
2832

29-
* [src](https://github.com/official-stockfish/Stockfish/tree/master/src), a subdirectory containing the full source code, including a Makefile
33+
* [src](https://github.com/official-stockfish/Stockfish/tree/master/src),
34+
a subdirectory containing the full source code, including a Makefile
3035
that can be used to compile Stockfish on Unix-like systems.
3136

3237
* a file with the .nnue extension, storing the neural network for the NNUE
@@ -67,9 +72,9 @@ change them via a chess GUI. This is a list of available UCI options in Stockfis
6772

6873
* #### EvalFile
6974
The name of the file of the NNUE evaluation parameters. Depending on the GUI the
70-
filename might have to include the full path to the folder/directory that contains the file.
71-
Other locations, such as the directory that contains the binary and the working directory,
72-
are also searched.
75+
filename might have to include the full path to the folder/directory that contains
76+
the file. Other locations, such as the directory that contains the binary and the
77+
working directory, are also searched.
7378

7479
* #### UCI_AnalyseMode
7580
An option handled by your GUI.
@@ -137,8 +142,9 @@ change them via a chess GUI. This is a list of available UCI options in Stockfis
137142
For developers the following non-standard commands might be of interest, mainly useful for debugging:
138143

139144
* #### bench *ttSize threads limit fenFile limitType evalType*
140-
Performs a standard benchmark using various options. The signature of a version (standard node
141-
count) is obtained using all defaults. `bench` is currently `bench 16 1 13 default depth mixed`.
145+
Performs a standard benchmark using various options. The signature of a version
146+
(standard node count) is obtained using all defaults. `bench` is currently
147+
`bench 16 1 13 default depth mixed`.
142148

143149
* #### compiler
144150
Give information about the compiler and environment used for building a binary.
@@ -174,26 +180,27 @@ on the evaluations of millions of positions at moderate search depth.
174180
The NNUE evaluation was first introduced in shogi, and ported to Stockfish afterward.
175181
It can be evaluated efficiently on CPUs, and exploits the fact that only parts
176182
of the neural network need to be updated after a typical chess move.
177-
[The nodchip repository](https://github.com/nodchip/Stockfish) provided the first version of
178-
the needed tools to train and develop the NNUE networks. Today, more advanced training tools are available
179-
in [the nnue-pytorch repository](https://github.com/glinscott/nnue-pytorch/), while data generation tools
180-
are available in [a dedicated branch](https://github.com/official-stockfish/Stockfish/tree/tools).
183+
[The nodchip repository](https://github.com/nodchip/Stockfish) provided the first
184+
version of the needed tools to train and develop the NNUE networks. Today, more
185+
advanced training tools are available in
186+
[the nnue-pytorch repository](https://github.com/glinscott/nnue-pytorch/),
187+
while data generation tools are available in
188+
[a dedicated branch](https://github.com/official-stockfish/Stockfish/tree/tools).
181189

182-
On CPUs supporting modern vector instructions
183-
(avx2 and similar), the NNUE evaluation results in much stronger playing strength, even
184-
if the nodes per second computed by the engine is somewhat lower (roughly 80% of nps
185-
is typical).
190+
On CPUs supporting modern vector instructions (avx2 and similar), the NNUE evaluation
191+
results in much stronger playing strength, even if the nodes per second computed by
192+
the engine is somewhat lower (roughly 80% of nps is typical).
186193

187194
Notes:
188195

189-
1) the NNUE evaluation depends on the Stockfish binary and the network parameter
190-
file (see the EvalFile UCI option). Not every parameter file is compatible with a given
191-
Stockfish binary, but the default value of the EvalFile UCI option is the name of a network
192-
that is guaranteed to be compatible with that binary.
196+
1) the NNUE evaluation depends on the Stockfish binary and the network parameter file
197+
(see the EvalFile UCI option). Not every parameter file is compatible with a given
198+
Stockfish binary, but the default value of the EvalFile UCI option is the name of a
199+
network that is guaranteed to be compatible with that binary.
193200

194201
2) to use the NNUE evaluation, the additional data file with neural network parameters
195-
needs to be available. Normally, this file is already embedded in the binary or it
196-
can be downloaded. The filename for the default (recommended) net can be found as the default
202+
needs to be available. Normally, this file is already embedded in the binary or it can
203+
be downloaded. The filename for the default (recommended) net can be found as the default
197204
value of the `EvalFile` UCI option, with the format `nn-[SHA256 first 12 digits].nnue`
198205
(for instance, `nn-c157e0a5755b.nnue`). This file can be downloaded from
199206
```
@@ -321,10 +328,10 @@ it (either by itself or as part of some bigger software package), or
321328
using it as the starting point for a software project of your own.
322329

323330
The only real limitation is that whenever you distribute Stockfish in
324-
some way, you MUST always include the license, the full source code, or a pointer
325-
to where the source code can be found, to generate the exact binary
326-
you are distributing. If you make any changes to the source code,
327-
these changes must also be made available under the GPL v3.
331+
some way, you MUST always include the license and the full source code
332+
(or a pointer to where the source code can be found) to generate the
333+
exact binary you are distributing. If you make any changes to the
334+
source code, these changes must also be made available under the GPL v3.
328335

329336
For full details, read the copy of the GPL v3 found in the file named
330337
[*Copying.txt*](https://github.com/official-stockfish/Stockfish/blob/master/Copying.txt).

src/misc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class ValueList {
152152
/// - the slope can be adjusted using C > 0, smaller C giving a steeper sigmoid
153153
/// - the slope of the sigmoid when t = x0 is P/(Q*C)
154154
/// - sigmoid is increasing with t when P > 0 and Q > 0
155-
/// - to get a decreasing sigmoid, call with -t, or change sign of P
155+
/// - to get a decreasing sigmoid, change sign of P
156156
/// - mean value of the sigmoid is y0
157157
///
158158
/// Use <https://www.desmos.com/calculator/jhh83sqq92> to draw the sigmoid
@@ -163,7 +163,8 @@ inline int64_t sigmoid(int64_t t, int64_t x0,
163163
int64_t P,
164164
int64_t Q)
165165
{
166-
assert(C > 0 && Q != 0);
166+
assert(C > 0);
167+
assert(Q != 0);
167168
return y0 + P * (t-x0) / (Q * (std::abs(t-x0) + C)) ;
168169
}
169170

src/movepick.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ void MovePicker::score() {
107107

108108
for (auto& m : *this)
109109
if constexpr (Type == CAPTURES)
110-
m.value = 6 * PieceValue[MG][pos.piece_on(to_sq(m))]
111-
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))];
110+
m.value = 6 * int(PieceValue[MG][pos.piece_on(to_sq(m))])
111+
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))];
112112

113113
else if constexpr (Type == QUIETS)
114114
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]

0 commit comments

Comments
 (0)