#include "game_state.h" #include "game_interface.h" namespace Hanabi { std::unique_ptr make_game_state( std::size_t num_suits, Hanabi::player_t num_players, std::vector const & deck, std::optional< uint8_t> score_goal ) { uint8_t actual_score_goal = score_goal.value_or(5 * num_suits); switch (num_players) { case 2: switch (num_suits) { case 3: return std::unique_ptr(new Hanabi::HanabiState<3, 2, 5>(deck, actual_score_goal)); case 4: return std::unique_ptr(new Hanabi::HanabiState<4, 2, 5>(deck, actual_score_goal)); case 5: return std::unique_ptr(new Hanabi::HanabiState<5, 2, 5>(deck, actual_score_goal)); case 6: return std::unique_ptr(new Hanabi::HanabiState<6, 2, 5>(deck, actual_score_goal)); default: throw std::runtime_error("Invalid number of suits: " + std::to_string(num_suits)); } case 3: switch (num_suits) { case 3: return std::unique_ptr(new Hanabi::HanabiState<3, 3, 5>(deck, actual_score_goal)); case 4: return std::unique_ptr(new Hanabi::HanabiState<4, 3, 5>(deck, actual_score_goal)); case 5: return std::unique_ptr(new Hanabi::HanabiState<5, 3, 5>(deck, actual_score_goal)); case 6: return std::unique_ptr(new Hanabi::HanabiState<6, 3, 5>(deck, actual_score_goal)); default: throw std::runtime_error("Invalid number of suits: " + std::to_string(num_suits)); } case 4: switch (num_suits) { case 3: return std::unique_ptr(new Hanabi::HanabiState<3, 4, 4>(deck, actual_score_goal)); case 4: return std::unique_ptr(new Hanabi::HanabiState<4, 4, 4>(deck, actual_score_goal)); case 5: return std::unique_ptr(new Hanabi::HanabiState<5, 4, 4>(deck, actual_score_goal)); case 6: return std::unique_ptr(new Hanabi::HanabiState<6, 4, 4>(deck, actual_score_goal)); default: throw std::runtime_error("Invalid number of suits: " + std::to_string(num_suits)); } case 5: switch (num_suits) { case 3: return std::unique_ptr(new Hanabi::HanabiState<3, 5, 4>(deck, actual_score_goal)); case 4: return std::unique_ptr(new Hanabi::HanabiState<4, 5, 4>(deck, actual_score_goal)); case 5: return std::unique_ptr(new Hanabi::HanabiState<5, 5, 4>(deck, actual_score_goal)); case 6: return std::unique_ptr(new Hanabi::HanabiState<6, 5, 4>(deck, actual_score_goal)); default: throw std::runtime_error("Invalid number of suits: " + std::to_string(num_suits)); } case 6: switch (num_suits) { case 3: return std::unique_ptr(new Hanabi::HanabiState<3, 6, 3>(deck, actual_score_goal)); case 4: return std::unique_ptr(new Hanabi::HanabiState<4, 6, 3>(deck, actual_score_goal)); case 5: return std::unique_ptr(new Hanabi::HanabiState<5, 6, 3>(deck, actual_score_goal)); case 6: return std::unique_ptr(new Hanabi::HanabiState<6, 6, 3>(deck, actual_score_goal)); default: throw std::runtime_error("Invalid number of suits: " + std::to_string(num_suits)); } default: throw std::runtime_error("Invalid number of players: " + std::to_string(num_players)); } } }