parse_attribute("maxRank", v->maxRank);
parse_attribute("maxFile", v->maxFile);
parse_attribute("chess960", v->chess960);
+ parse_attribute("twoBoards", v->twoBoards);
parse_attribute("startFen", v->startFen);
parse_attribute("promotionRank", v->promotionRank);
// promotion piece types
const Variant* variant() const;
Rank max_rank() const;
File max_file() const;
+ bool two_boards() const;
Bitboard board_bb() const;
Bitboard board_bb(Color c, PieceType pt) const;
const std::set<PieceType>& piece_types() const;
return var->maxFile;
}
+inline bool Position::two_boards() const {
+ assert(var != nullptr);
+ return var->twoBoards;
+}
+
inline Bitboard Position::board_bb() const {
assert(var != nullptr);
return board_size_bb(var->maxFile, var->maxRank);
// GUI sends a "stop" or "ponderhit" command. We therefore simply wait here
// until the GUI sends one of those commands.
- while (!Threads.stop && (ponder || Limits.infinite))
+ while (!Threads.stop && (ponder || Limits.infinite || (rootPos.two_boards() && (Threads.sit || this->rootMoves[0].score <= VALUE_MATED_IN_MAX_PLY) && Time.elapsed() < Limits.time[us] - 1000)))
{} // Busy wait for a stop or a ponder reset
// Stop the threads if not already stopped (also raise the stop if
// keep pondering until the GUI sends "ponderhit" or "stop".
if (mainThread->ponder)
mainThread->stopOnPonderhit = true;
- else
+ else if (!Threads.sit && !(rootPos.two_boards() && bestValue <= VALUE_MATED_IN_MAX_PLY))
Threads.stop = true;
}
}
std::atomic_bool stop;
std::atomic_bool abort;
+ std::atomic_bool sit;
StateListPtr setupStates;
Variant* bughouse_variant() {
Variant* v = crazyhouse_variant();
v->variantTemplate = "bughouse";
+ v->twoBoards = true;
v->capturesToHand = false;
return v;
}
Rank maxRank = RANK_8;
File maxFile = FILE_H;
bool chess960 = false;
+ bool twoBoards = false;
std::set<PieceType> pieceTypes = { PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING };
std::string pieceToChar = " PNBRQ" + std::string(KING - QUEEN - 1, ' ') + "K" + std::string(PIECE_TYPE_NB - KING - 1, ' ')
+ " pnbrq" + std::string(KING - QUEEN - 1, ' ') + "k" + std::string(PIECE_TYPE_NB - KING - 1, ' ');
# maxRank: maximum rank [Rank] (default: 8)
# maxFile: maximum file [File] (default: 8)
# chess960: allow chess960 castling [bool] (default: false)
+# twoBoards: the game is influenced by a second board (e.g., bughouse) [bool] (default: false)
# startFen: FEN of starting position (default: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1)
# promotionRank: relative rank required to reach for promotion [Rank] (default: 8)
# promotionPieceTypes: pawn promotion options using their one-letter representations (default: nbrq)
setboard(pos, states);
// play second by default
playColor = ~pos.side_to_move();
+ Threads.sit = false;
}
else if (token == "variant")
{
else if (token == "partner") {} // ignore for now
else if (token == "ptell")
{
- // TODO: parse requests by partner
+ // parse requests by partner
+ is >> token;
+ if (token == "help")
+ sync_cout << "tellics ptell I listen to the commands help, sit, and go." << sync_endl;
+ else if (token == "hi" || token == "hello")
+ sync_cout << "tellics ptell hi" << sync_endl;
+ else if (token == "sit")
+ {
+ Threads.stop = false;
+ Threads.sit = true;
+ sync_cout << "tellics ptell I sit, tell me 'go' to continue" << sync_endl;
+ }
+ else if (token == "go")
+ {
+ Threads.sit = false;
+ Threads.stop = true;
+ }
}
else if (token == "holding")
{