├── AUTHORS
├── src
├── syzygy
│ ├── tbprobe.h
│ └── tbcore.h
├── evaluate.h
├── main.cpp
├── timeman.h
├── movegen.h
├── uci.h
├── thread_win32.h
├── pawns.h
├── material.h
├── misc.h
├── thread.h
├── endgame.h
├── search.h
├── tt.h
├── movepick.h
├── tt.cpp
├── psqt.cpp
├── timeman.cpp
├── thread.cpp
├── ucioption.cpp
├── misc.cpp
├── benchmark.cpp
├── bitbase.cpp
├── material.cpp
├── uci.cpp
├── movepick.cpp
├── bitboard.h
├── pawns.cpp
├── bitboard.cpp
├── types.h
├── position.h
├── Makefile
└── movegen.cpp
├── .travis.yml
└── Readme.md
/AUTHORS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Anil-matcha/Stockfish/master/AUTHORS
--------------------------------------------------------------------------------
/src/syzygy/tbprobe.h:
--------------------------------------------------------------------------------
1 | #ifndef TBPROBE_H
2 | #define TBPROBE_H
3 |
4 | #include "../search.h"
5 |
6 | namespace Tablebases {
7 |
8 | extern int MaxCardinality;
9 |
10 | void init(const std::string& path);
11 | int probe_wdl(Position& pos, int *success);
12 | int probe_dtz(Position& pos, int *success);
13 | bool root_probe(Position& pos, Search::RootMoveVector& rootMoves, Value& score);
14 | bool root_probe_wdl(Position& pos, Search::RootMoveVector& rootMoves, Value& score);
15 |
16 | }
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 | sudo: required
3 | dist: trusty
4 |
5 | matrix:
6 | include:
7 | - os: linux
8 | compiler: gcc
9 | addons:
10 | apt:
11 | sources: ['ubuntu-toolchain-r-test']
12 | packages: ['g++-multilib']
13 | env:
14 | - COMPILER=g++
15 | - COMP=gcc
16 |
17 | - os: linux
18 | compiler: clang
19 | addons:
20 | apt:
21 | sources: ['ubuntu-toolchain-r-test']
22 | packages: ['clang', 'g++-multilib']
23 | env:
24 | - COMPILER=clang++
25 | - COMP=clang
26 |
27 | - os: osx
28 | compiler: gcc
29 | env:
30 | - COMPILER=g++
31 | - COMP=gcc
32 |
33 | - os: osx
34 | compiler: clang
35 | env:
36 | - COMPILER=clang++ V='Apple LLVM 6.0' # Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
37 | - COMP=clang
38 |
39 | branches:
40 | only:
41 | - master
42 |
43 | before_script:
44 | - cd src
45 |
46 | script:
47 | - make clean && make build ARCH=x86-64 && ./stockfish bench 2>&1 >/dev/null | grep 'Nodes searched' | tee bench1
48 | - make clean && make build ARCH=x86-32 && ./stockfish bench 2>&1 >/dev/null | grep 'Nodes searched' | tee bench2
49 | - echo "Checking for same bench numbers..."
50 | - diff bench1 bench2 > result
51 | - test ! -s result
52 |
--------------------------------------------------------------------------------
/src/evaluate.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
4 | Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
5 | Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
6 |
7 | Stockfish is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Stockfish is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 |
21 | #ifndef EVALUATE_H_INCLUDED
22 | #define EVALUATE_H_INCLUDED
23 |
24 | #include
25 |
26 | #include "types.h"
27 |
28 | class Position;
29 |
30 | namespace Eval {
31 |
32 | const Value Tempo = Value(20); // Must be visible to search
33 |
34 | void init();
35 | std::string trace(const Position& pos);
36 |
37 | template
38 | Value evaluate(const Position& pos);
39 | }
40 |
41 | #endif // #ifndef EVALUATE_H_INCLUDED
42 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
4 | Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
5 | Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
6 |
7 | Stockfish is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Stockfish is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 |
21 | #include
22 |
23 | #include "bitboard.h"
24 | #include "evaluate.h"
25 | #include "position.h"
26 | #include "search.h"
27 | #include "thread.h"
28 | #include "tt.h"
29 | #include "uci.h"
30 | #include "syzygy/tbprobe.h"
31 |
32 | int main(int argc, char* argv[]) {
33 |
34 | std::cout << engine_info() << std::endl;
35 |
36 | UCI::init(Options);
37 | PSQT::init();
38 | Bitboards::init();
39 | Position::init();
40 | Bitbases::init();
41 | Search::init();
42 | Eval::init();
43 | Pawns::init();
44 | Threads.init();
45 | Tablebases::init(Options["SyzygyPath"]);
46 | TT.resize(Options["Hash"]);
47 |
48 | UCI::loop(argc, argv);
49 |
50 | Threads.exit();
51 | return 0;
52 | }
53 |
--------------------------------------------------------------------------------
/src/timeman.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
4 | Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
5 | Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
6 |
7 | Stockfish is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Stockfish is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 |
21 | #ifndef TIMEMAN_H_INCLUDED
22 | #define TIMEMAN_H_INCLUDED
23 |
24 | #include "misc.h"
25 | #include "search.h"
26 | #include "thread.h"
27 |
28 | /// The TimeManagement class computes the optimal time to think depending on
29 | /// the maximum available time, the game move number and other parameters.
30 |
31 | class TimeManagement {
32 | public:
33 | void init(Search::LimitsType& limits, Color us, int ply);
34 | int optimum() const { return optimumTime; }
35 | int maximum() const { return maximumTime; }
36 | int elapsed() const { return int(Search::Limits.npmsec ? Threads.nodes_searched() : now() - startTime); }
37 |
38 | int64_t availableNodes; // When in 'nodes as time' mode
39 |
40 | private:
41 | TimePoint startTime;
42 | int optimumTime;
43 | int maximumTime;
44 | };
45 |
46 | extern TimeManagement Time;
47 |
48 | #endif // #ifndef TIMEMAN_H_INCLUDED
49 |
--------------------------------------------------------------------------------
/src/movegen.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
4 | Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
5 | Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
6 |
7 | Stockfish is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Stockfish is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 |
21 | #ifndef MOVEGEN_H_INCLUDED
22 | #define MOVEGEN_H_INCLUDED
23 |
24 | #include "types.h"
25 |
26 | class Position;
27 |
28 | enum GenType {
29 | CAPTURES,
30 | QUIETS,
31 | QUIET_CHECKS,
32 | EVASIONS,
33 | NON_EVASIONS,
34 | LEGAL
35 | };
36 |
37 | struct ExtMove {
38 | Move move;
39 | Value value;
40 |
41 | operator Move() const { return move; }
42 | void operator=(Move m) { move = m; }
43 | };
44 |
45 | inline bool operator<(const ExtMove& f, const ExtMove& s) {
46 | return f.value < s.value;
47 | }
48 |
49 | template
50 | ExtMove* generate(const Position& pos, ExtMove* moveList);
51 |
52 | /// The MoveList struct is a simple wrapper around generate(). It sometimes comes
53 | /// in handy to use this class instead of the low level generate() function.
54 | template
55 | struct MoveList {
56 |
57 | explicit MoveList(const Position& pos) : last(generate(pos, moveList)) {}
58 | const ExtMove* begin() const { return moveList; }
59 | const ExtMove* end() const { return last; }
60 | size_t size() const { return last - moveList; }
61 | bool contains(Move move) const {
62 | for (const auto& m : *this) if (m == move) return true;
63 | return false;
64 | }
65 |
66 | private:
67 | ExtMove moveList[MAX_MOVES], *last;
68 | };
69 |
70 | #endif // #ifndef MOVEGEN_H_INCLUDED
71 |
--------------------------------------------------------------------------------
/src/uci.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
4 | Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
5 | Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
6 |
7 | Stockfish is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Stockfish is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 |
21 | #ifndef UCI_H_INCLUDED
22 | #define UCI_H_INCLUDED
23 |
24 | #include