Rev 176 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 176 | Rev 185 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad |
4 | Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad |
5 | Copyright (C) 2015- |
5 | Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad |
6 | 6 | ||
7 | Stockfish is free software: you can redistribute it and/or modify |
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 |
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 |
9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. |
10 | (at your option) any later version. |
Line 54... | Line 54... | ||
54 | /// init() initializes the UCI options to their hard-coded default values |
54 | /// init() initializes the UCI options to their hard-coded default values |
55 | 55 | ||
56 | void init(OptionsMap& o) { |
56 | void init(OptionsMap& o) { |
57 | 57 | ||
58 | // at most 2^32 clusters. |
58 | // at most 2^32 clusters. |
59 |
|
59 | constexpr int MaxHashMB = Is64Bit ? 131072 : 2048; |
60 | 60 | ||
61 | o["Debug Log File"] << Option("", on_logger); |
61 | o["Debug Log File"] << Option("", on_logger); |
62 | o["Contempt"] << Option( |
62 | o["Contempt"] << Option(24, -100, 100); |
- | 63 | o["Analysis Contempt"] << Option("Both var Off var White var Black var Both", "Both"); |
|
63 | o["Threads"] << Option(1, 1, 512, on_threads); |
64 | o["Threads"] << Option(1, 1, 512, on_threads); |
64 | o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size); |
65 | o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size); |
65 | o["Clear Hash"] << Option(on_clear_hash); |
66 | o["Clear Hash"] << Option(on_clear_hash); |
66 | o["Ponder"] << Option(false); |
67 | o["Ponder"] << Option(false); |
67 | o["MultiPV"] << Option(1, 1, 500); |
68 | o["MultiPV"] << Option(1, 1, 500); |
68 | o["Skill Level"] << Option(20, 0, 20); |
69 | o["Skill Level"] << Option(20, 0, 20); |
69 | o["Move Overhead"] << Option(30, 0, 5000); |
70 | o["Move Overhead"] << Option(30, 0, 5000); |
70 | o["Minimum Thinking Time"] << Option(20, 0, 5000); |
71 | o["Minimum Thinking Time"] << Option(20, 0, 5000); |
71 | o["Slow Mover"] << Option( |
72 | o["Slow Mover"] << Option(84, 10, 1000); |
72 | o["nodestime"] << Option(0, 0, 10000); |
73 | o["nodestime"] << Option(0, 0, 10000); |
73 | o["UCI_Chess960"] << Option(false); |
74 | o["UCI_Chess960"] << Option(false); |
- | 75 | o["UCI_AnalyseMode"] << Option(false); |
|
74 | o["SyzygyPath"] << Option(" |
76 | o["SyzygyPath"] << Option("<empty>", on_tb_path); |
75 | o["SyzygyProbeDepth"] << Option(1, 1, 100); |
77 | o["SyzygyProbeDepth"] << Option(1, 1, 100); |
76 | o["Syzygy50MoveRule"] << Option(true); |
78 | o["Syzygy50MoveRule"] << Option(true); |
77 | o["SyzygyProbeLimit"] << Option( |
79 | o["SyzygyProbeLimit"] << Option(7, 0, 7); |
78 | } |
80 | } |
79 | 81 | ||
80 | 82 | ||
81 | /// operator<<() is used to print all the options default values in chronological |
83 | /// operator<<() is used to print all the options default values in chronological |
82 | /// insertion order (the idx field) and in the format defined by the UCI protocol. |
84 | /// insertion order (the idx field) and in the format defined by the UCI protocol. |
Line 88... | Line 90... | ||
88 | if (it.second.idx == idx) |
90 | if (it.second.idx == idx) |
89 | { |
91 | { |
90 | const Option& o = it.second; |
92 | const Option& o = it.second; |
91 | os << "\noption name " << it.first << " type " << o.type; |
93 | os << "\noption name " << it.first << " type " << o.type; |
92 | 94 | ||
93 | if (o.type |
95 | if (o.type == "string" || o.type == "check" || o.type == "combo") |
94 | os << " default " << o.defaultValue; |
96 | os << " default " << o.defaultValue; |
95 | 97 | ||
96 | if (o.type == "spin") |
98 | if (o.type == "spin") |
- | 99 | os << " default " << int(stof(o.defaultValue)) |
|
- | 100 | << " min " << o.min |
|
97 |
|
101 | << " max " << o.max; |
98 | 102 | ||
99 | break; |
103 | break; |
100 | } |
104 | } |
101 | 105 | ||
102 | return os; |
106 | return os; |
Line 112... | Line 116... | ||
112 | { defaultValue = currentValue = (v ? "true" : "false"); } |
116 | { defaultValue = currentValue = (v ? "true" : "false"); } |
113 | 117 | ||
114 | Option::Option(OnChange f) : type("button"), min(0), max(0), on_change(f) |
118 | Option::Option(OnChange f) : type("button"), min(0), max(0), on_change(f) |
115 | {} |
119 | {} |
116 | 120 | ||
117 | Option::Option( |
121 | Option::Option(double v, int minv, int maxv, OnChange f) : type("spin"), min(minv), max(maxv), on_change(f) |
118 | { defaultValue = currentValue = std::to_string(v); } |
122 | { defaultValue = currentValue = std::to_string(v); } |
119 | 123 | ||
- | 124 | Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f) |
|
- | 125 | { defaultValue = v; currentValue = cur; } |
|
- | 126 | ||
120 | Option::operator |
127 | Option::operator double() const { |
121 | assert(type == "check" || type == "spin"); |
128 | assert(type == "check" || type == "spin"); |
122 | return (type == "spin" ? |
129 | return (type == "spin" ? stof(currentValue) : currentValue == "true"); |
123 | } |
130 | } |
124 | 131 | ||
125 | Option::operator std::string() const { |
132 | Option::operator std::string() const { |
126 | assert(type == "string"); |
133 | assert(type == "string"); |
127 | return currentValue; |
134 | return currentValue; |
- | 135 | } |
|
- | 136 | ||
- | 137 | bool Option::operator==(const char* s) const { |
|
- | 138 | assert(type == "combo"); |
|
- | 139 | return !CaseInsensitiveLess()(currentValue, s) |
|
- | 140 | && !CaseInsensitiveLess()(s, currentValue); |
|
128 | } |
141 | } |
129 | 142 | ||
130 | 143 | ||
131 | /// operator<<() inits options and assigns idx in the correct printing order |
144 | /// operator<<() inits options and assigns idx in the correct printing order |
132 | 145 | ||
Line 147... | Line 160... | ||
147 | 160 | ||
148 | assert(!type.empty()); |
161 | assert(!type.empty()); |
149 | 162 | ||
150 | if ( (type != "button" && v.empty()) |
163 | if ( (type != "button" && v.empty()) |
151 | || (type == "check" && v != "true" && v != "false") |
164 | || (type == "check" && v != "true" && v != "false") |
152 | || (type == "spin" && ( |
165 | || (type == "spin" && (stof(v) < min || stof(v) > max))) |
153 | return *this; |
166 | return *this; |
154 | 167 | ||
155 | if (type != "button") |
168 | if (type != "button") |
156 | currentValue = v; |
169 | currentValue = v; |
157 | 170 |