F7RLQRYDCN3Y3JJBCI7NH5RFMJUNIQVXOPZV7RUUIBSKMIYNNYLQC
CU3XNAGXZHXACBEDPM3THFT6AWAJ4HC5PXZM3Z72WWVMSHPOOXFQC
X3FYJUNL5ORLRC7TW3C5OMNZOX4JEWL73RXOQZLRKLAUBVNARIMAC
R5F5KMWWZ4VS67CSIWRNRM4LNPPXVXSQZLHEZMT6XZODV4AK2MBQC
A46B5KNQFPTZEIL2JZKD2CQELGU3COE6FGTV2ABS5U7DVTVDGEBQC
GLTWBA5NKQIHAL23SWKCFOZQH62W6B3LX4RC5GFQUEQUIYN4OKSAC
BL3ZR4OWJM54HFXUNMUZKB5YQYVBT7ETFIXCOXWL6S5SZFM6IFDQC
RNEXG5IFDKMHSUR6RMNTI3Y32ORLVMZ6UJYKHLV2XBMT2QONBTVQC
G4HJL4QLASCZBWYGCEXYYRBYL7UVX6ENELHRRBFB5UAXXGVVGZGQC
WAJ2J7G4QZE4LLGGZNIQ3ZIBCR3CSFOH3V2NIK2JQPALFHARRNMAC
Z4PX3GURAMMW55R5KRP5WCO2CXFEI6LBULGBQRYTABBONCOZ5NHQC
if (std.mem.containsAtLeast(u8, in, 1, "depth")) {
// go depth <some val>
const depth = try std.fmt.parseUnsigned(u8, in[9..], 10);
try search.bestMove(depth);
return;
var options: SearchOptions = .{};
// INFINITE
if (std.mem.containsAtLeast(u8, in, 1, "infinite")) {
options.depth = std.math.maxInt(usize);
}
inline for ([_]Str{ "depth", "movetime" }) |keyword| {
const start = std.mem.indexOf(u8, in, keyword);
if (start != null) {
const pos = keyword.len + 1 + start.?;
const end = std.mem.indexOfPos(u8, in, pos, " ") orelse in.len;
const value = try std.fmt.parseUnsigned(usize, in[pos..end], 10);
@field(options, keyword) = value;
}
inline fn stopSearch(self: @This()) bool {
if (@atomicLoad(bool, &self.stop, std.builtin.AtomicOrder.Unordered))
return true
else
inline fn stopSearch(self: *@This()) bool {
if ((self.timer.read() / std.time.ns_per_ms) > self.movetime or
@atomicLoad(bool, &self.stop, std.builtin.AtomicOrder.Unordered))
{
return true;
} else {