2023-08-04 16:28:41 +02:00
|
|
|
//
|
|
|
|
// Created by maximilian on 7/13/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <boost/rational.hpp>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <iostream>
|
|
|
|
#include <optional>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "game_state.h"
|
2023-08-05 00:34:31 +02:00
|
|
|
#include "download.h"
|
2023-08-06 15:02:50 +02:00
|
|
|
#include "myassert.h"
|
|
|
|
|
2023-08-04 16:28:41 +02:00
|
|
|
|
2023-08-05 00:34:31 +02:00
|
|
|
namespace Hanabi {
|
2023-08-04 16:28:41 +02:00
|
|
|
|
2023-08-06 15:02:50 +02:00
|
|
|
void download(int turn) {
|
2023-08-06 22:06:58 +02:00
|
|
|
auto game = Download::get_game("1004116", turn);
|
|
|
|
std::cout << "Analysing state: " << *game << std::endl;
|
|
|
|
auto res = game->backtrack(1);
|
|
|
|
std::cout.precision(10);
|
2023-08-06 13:53:18 +02:00
|
|
|
std::cout << "Probability with optimal play: " << res << std::endl;
|
2023-08-06 22:06:58 +02:00
|
|
|
std::cout << "Enumerated " << game->enumerated_states() << " states" << std::endl;
|
2023-08-06 11:54:57 +02:00
|
|
|
}
|
2023-08-04 16:28:41 +02:00
|
|
|
|
2023-08-05 00:34:31 +02:00
|
|
|
void print_sizes() {
|
2023-08-06 10:23:29 +02:00
|
|
|
std::cout << "size of card -> hand map: " << sizeof(HanabiState<5, 3, 4>)
|
2023-08-05 00:34:31 +02:00
|
|
|
<< std::endl;
|
2023-08-04 16:28:41 +02:00
|
|
|
|
|
|
|
unsigned exp = 32;
|
2023-08-05 00:34:31 +02:00
|
|
|
std::cout << "Pair size: " << sizeof(std::pair<std::uint32_t, float>)
|
|
|
|
<< std::endl;
|
2023-08-04 16:28:41 +02:00
|
|
|
std::cout << sizeof(boost::rational<int>) << std::endl;
|
|
|
|
std::cout << (1ul << exp) << std::endl;
|
|
|
|
}
|
|
|
|
|
2023-08-05 00:34:31 +02:00
|
|
|
}
|
|
|
|
|
2023-08-06 15:02:50 +02:00
|
|
|
int main(int argc, char *argv[]) {
|
2023-08-05 13:51:55 +02:00
|
|
|
// Hanabi::test_game();
|
2023-08-06 15:02:50 +02:00
|
|
|
if(argc == 2) {
|
|
|
|
std::string turn (argv[1]);
|
|
|
|
Hanabi::download(std::stoi(turn));
|
|
|
|
}
|
2023-08-04 16:28:41 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|