print duration
This commit is contained in:
parent
78a703434d
commit
62bf71a2f2
1 changed files with 9 additions and 9 deletions
18
src/main.cpp
18
src/main.cpp
|
@ -1,6 +1,7 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <variant>
|
||||
#include <chrono>
|
||||
|
||||
#include "game_state.h"
|
||||
#include "download.h"
|
||||
|
@ -19,20 +20,19 @@ namespace Hanabi {
|
|||
return;
|
||||
}
|
||||
|
||||
std::cout << "Analysing state: " << std::endl << *game << std::endl;
|
||||
std::cout << "Analysing state: " << std::endl << std::endl << *game << std::endl;
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
auto res = game->evaluate_state();
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
|
||||
std::cout.precision(10);
|
||||
std::cout << std::endl;
|
||||
std::cout << "Probability with optimal play: " << res << std::endl;
|
||||
std::cout << "Enumerated " << game->enumerated_states() << " states" << std::endl;
|
||||
std::cout << "Visited " << game->position_tablebase().size() << " unique game states. " << std::endl;
|
||||
unsigned long biggest_key = 0;
|
||||
for(const auto& [key, prob] : game->position_tablebase()) {
|
||||
biggest_key = std::max(biggest_key, key);
|
||||
}
|
||||
std::cout << "Biggest key generated is " << biggest_key << std::endl;
|
||||
std::cout << "Probability with optimal play: " << res << " ~ " << std::setprecision(5) << boost::rational_cast<double>(res) * 100 << "%" << std::endl;
|
||||
std::cout << "Took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start) << "." << std::endl;
|
||||
std::cout << "Visited " << game->enumerated_states() << " states." << std::endl;
|
||||
std::cout << "Enumerated " << game->position_tablebase().size() << " unique game states. " << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Dropping into interactive command line to explore result (type 'help'):" << std::endl;
|
||||
|
||||
auto game_shared = std::shared_ptr<HanabiStateIF>(game.release());
|
||||
auto states = game_shared->possible_next_states(0, false);
|
||||
|
|
Loading…
Reference in a new issue