Skip to content

Commit ec707b9

Browse files
committed
Apply clang-format
1 parent b055749 commit ec707b9

2 files changed

Lines changed: 27 additions & 17 deletions

File tree

search.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ using namespace chess;
1010
namespace engine {
1111
TranspositionTable search::tt(16);
1212
std::atomic<bool> stopSearch{false};
13-
void search::stop() {
14-
stopSearch.store(true, std::memory_order_relaxed);
15-
}
13+
void search::stop() { stopSearch.store(true, std::memory_order_relaxed); }
1614
struct Session {
1715
timeman::TimeManagement tm;
1816
timeman::LimitsType tc;
@@ -71,7 +69,7 @@ Value doSearch(Board &board, int depth, Value alpha, Value beta,
7169
uint64_t hash = board.hash();
7270
Move preferred = Move::none();
7371
if (TTEntry *entry = search::tt.lookup(hash)) {
74-
if (entry->getDepth() >= depth && ply!=0) {
72+
if (entry->getDepth() >= depth && ply != 0) {
7573
Value ttScore = entry->getScore();
7674
TTFlag flag = entry->getFlag();
7775

@@ -163,7 +161,7 @@ Value doSearch(Board &board, int depth, Value alpha, Value beta,
163161
}
164162
void search::search(const chess::Board &board,
165163
const timeman::LimitsType timecontrol) {
166-
stopSearch=false;
164+
stopSearch = false;
167165
static double originalTimeAdjust = -1;
168166
Session session;
169167
session.tc = timecontrol;
@@ -195,7 +193,17 @@ void search::search(const chess::Board &board,
195193
info.multiPV = 1;
196194
info.score = score_;
197195
TTEntry *entry = tt.lookup(board.hash());
198-
if (entry) switch(entry->getFlag()){ case LOWERBOUND: info.bound="lowerbound"; break; case UPPERBOUND: info.bound="upperbound";break;default:break;}
196+
if (entry)
197+
switch (entry->getFlag()) {
198+
case LOWERBOUND:
199+
info.bound = "lowerbound";
200+
break;
201+
case UPPERBOUND:
202+
info.bound = "upperbound";
203+
break;
204+
default:
205+
break;
206+
}
199207
std::string pv = "";
200208
for (Move *m = session.pv[0]; *m != Move::none(); m++)
201209
pv += chess::uci::moveToUci(*m, board.chess960()) + " ";

uci.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include "ucioption.h"
55
#include <algorithm>
66
#include <iostream>
7-
#include <sstream>
8-
#include <thread>
97
#include <position.h>
108
#include <printers.h>
9+
#include <sstream>
10+
#include <thread>
1111
using namespace engine;
1212
chess::Position pos;
1313
OptionsMap engine::options;
@@ -74,14 +74,14 @@ timeman::LimitsType parse_limits(std::istream &is) {
7474
std::thread searchThread;
7575

7676
void handleGo(std::istringstream &ss) {
77-
if (searchThread.joinable()) {
78-
search::stop();
79-
searchThread.join();
80-
}
77+
if (searchThread.joinable()) {
78+
search::stop();
79+
searchThread.join();
80+
}
8181

82-
searchThread = std::thread([ss = std::move(ss)]() mutable {
83-
search::search(pos, parse_limits(ss));
84-
});
82+
searchThread = std::thread([ss = std::move(ss)]() mutable {
83+
search::search(pos, parse_limits(ss));
84+
});
8585
}
8686
template <typename... Ts> struct overload : Ts... {
8787
using Ts::operator()...;
@@ -181,11 +181,13 @@ void engine::loop() {
181181
break;
182182
} else if (token == "stop") {
183183
search::stop();
184-
if (searchThread.joinable()) searchThread.join();
184+
if (searchThread.joinable())
185+
searchThread.join();
185186
break;
186187
} else if (token == "quit") {
187188
search::stop();
188-
if (searchThread.joinable()) searchThread.join();
189+
if (searchThread.joinable())
190+
searchThread.join();
189191
return;
190192
} else if (token == "setoption") {
191193
options.setoption(ss);

0 commit comments

Comments
 (0)