![]() Clang 3.5 issues warning on constructs like: abs(f1 - f2). The thing is that f1 and f2 are enum types, and the range given (all positive) allows the compiler to choose an unsigned type (efficiency being one reason to prefer unsigned arithmetic). If f1 < f2 are unsigned, then f1 - f2 wraps around zero and the abs() becomes a no-op. It's the reinterpretation of the unsigned result (large value) as a signed int that happens to give the correct result, thanks to 2's complement. This is all tricky and dangerous! In the spirit of the standard, we assume nothing on the signedness of enums, and simply calculate the rank and file distances as: - rank_dist(r1, r2) = r1 < r2 ? r2 - r1 : r1 - r2 - file_dist(f1, f2) = f1 < f2 ? f2 - f1 : f1 - f2 this logic can in fact be applied to any enum we may use, so for better generality and to avoid code duplication, we use a template function diff() here. No functional change. Resolves #95 |
||
---|---|---|
src | ||
AUTHORS | ||
Copying.txt | ||
Readme.md |
Overview
Stockfish is a free UCI chess engine derived from Glaurung 2.1. It is not a complete chess program and requires some UCI-compatible GUI (e.g. XBoard with PolyGlot, eboard, Arena, Sigma Chess, Shredder, Chess Partner or Fritz) in order to be used comfortably. Read the documentation for your GUI of choice for information about how to use Stockfish with it.
This version of Stockfish supports up to 128 cores. The engine defaults to one search thread, so it is therefore recommended to inspect the value of the Threads UCI parameter, and to make sure it equals the number of CPU cores on your computer.
Files
This distribution of Stockfish consists of the following files:
-
Readme.md, the file you are currently reading.
-
Copying.txt, a text file containing the GNU General Public License.
-
src, a subdirectory containing the full source code, including a Makefile that can be used to compile Stockfish on Unix-like systems.
Compiling it yourself
On Unix-like systems, it should be possible to compile Stockfish directly from the source code with the included Makefile.
Stockfish has support for 32 or 64-bit CPUs, the hardware POPCNT instruction, big-endian machines such as Power PC, and other platforms.
In general it is recommended to run make help
to see a list of make
targets with corresponding descriptions. When not using the Makefile to
compile (for instance with Microsoft MSVC) you need to manually
set/unset some switches in the compiler command line; see file types.h
for a quick reference.
Terms of use
Stockfish is free, and distributed under the GNU General Public License (GPL). Essentially, this means that you are free to do almost exactly what you want with the program, including distributing it among your friends, making it available for download from your web site, selling it (either by itself or as part of some bigger software package), or using it as the starting point for a software project of your own.
The only real limitation is that whenever you distribute Stockfish in some way, you must always include the full source code, or a pointer to where the source code can be found. If you make any changes to the source code, these changes must also be made available under the GPL.
For full details, read the copy of the GPL found in the file named Copying.txt