Maximilian Keßler
4e67ffa9ee
A third CLI argument is now accepted, describing a score goal. The program will then treat reaching this score as a win and calculate lines optimized for this score, ignoring any (possible) higher scores.
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
#ifndef DYNAMIC_PROGRAM_DOWNLOAD_H
|
|
#define DYNAMIC_PROGRAM_DOWNLOAD_H
|
|
|
|
#include <iostream>
|
|
#include <variant>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
#include <boost/json.hpp>
|
|
|
|
#include "game_state.h"
|
|
#include "myassert.h"
|
|
|
|
namespace Hanabi {
|
|
Card tag_invoke(boost::json::value_to_tag<Card>, boost::json::value const &jv);
|
|
void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Hanabi::Card const &card);
|
|
}
|
|
|
|
namespace Download {
|
|
|
|
struct Action {
|
|
Hanabi::ActionType type{};
|
|
int8_t target{};
|
|
};
|
|
|
|
Action tag_invoke(boost::json::value_to_tag<Action>, boost::json::value const &jv);
|
|
|
|
std::pair<std::vector<Hanabi::Card>, Hanabi::rank_t> parse_deck(const boost::json::value &deck_json);
|
|
|
|
std::vector<Action> parse_actions(const boost::json::value &action_json);
|
|
|
|
std::optional<boost::json::object> download_game_json(int game_id);
|
|
|
|
std::optional<boost::json::object> open_game_json(const char *filename);
|
|
|
|
/**
|
|
* @brief Create game object from given source
|
|
* @param game_spec Either an id to download from hanab.live or a filename with a json specification
|
|
* @param turn Turn to skip to
|
|
* @param draw_pile_break Minimum draw pile size of produced game
|
|
* @return Game state
|
|
*
|
|
* If both turn and draw_pile_break are specified, the game skips until the specified turn or the first time the
|
|
* draw pile hits the given size, whichever comes first
|
|
*
|
|
* @note Turns start counting at 1, since this is also the way hanab.live does it.
|
|
*/
|
|
std::unique_ptr<Hanabi::HanabiStateIF> get_game(std::variant<int, const char*> game_spec, unsigned turn = 1, size_t draw_pile_break = 0, std::optional<uint8_t> score_goal = std::nullopt);
|
|
|
|
} // namespace Download
|
|
|
|
#endif // DYNAMIC_PROGRAM_DOWNLOAD_H
|