10#include <unordered_set>
17 std::variant<std::string, size_t, int64_t, DepthType>>;
31 "num_zobrist_calculators",
32 "minimax_search_depth"
36 template <
typename T,
typename F>
39 const std::string &key,
42 if (input_map.count(key) > 0) {
44 setter(std::get<T>(input_map.at(key)));
45 }
catch (
const std::bad_variant_access &e) {
46 throw std::runtime_error(
"Invalid type for key: " + key);
61 if (player_input.count(
"color") == 0) {
62 throw std::runtime_error(
"Input validation failed: 'color' key is required.");
66 for (
const auto &[key, _] : player_input) {
68 throw std::runtime_error(
69 "Input validation failed: Unrecognized key '" + key +
"'."
75 TrySetAttribute<std::string>(player_input,
"color", [
this](
auto color_str) {
80 TrySetAttribute<std::string>(
83 [
this](
auto evaluator_type_str) {
89 TrySetAttribute<size_t>(player_input,
"key_size_bits", [
this](
auto key_size_bits) {
94 TrySetAttribute<size_t>(
96 "num_zobrist_calculators",
97 [
this](
auto num_calculators) {
104 TrySetAttribute<DepthType>(player_input,
"minimax_search_depth", [
this](
auto depth) {
Constants, typedefs, and simple structs used by gameboard::GameBoard.
void TrySetAttribute(const PlayerInputType &input_map, const std::string &key, F setter)
size_t zobrist_key_size_bits_
EvaluatorType evaluator_type_
PlayerInputTranslator input_translator_
const std::unordered_set< std::string > allowed_keys_
gameboard::PieceColor color_
DepthType minimax_search_depth_
size_t zobrist_calculator_count_
PlayerSpecBuilder & SetMultipleAttributes(const PlayerInputType &player_input)
Defines GamePiece and supporting constants and free functions.
std::unordered_map< std::string, std::variant< std::string, size_t, int64_t, DepthType > > PlayerInputType
Tracking piece positions and determining legal moves.