add debug macro

This commit is contained in:
Maximilian Keßler 2024-01-09 01:10:27 +01:00
parent 930ba9b408
commit 5b6e877a51
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -1163,6 +1163,22 @@ namespace Hanabi
unsigned long id, Hanabi::probability_t probability unsigned long id, Hanabi::probability_t probability
) )
{ {
// This macro can be activated if we want to dump details on all game states visited for analysis purposes.
#ifdef DUMP_STATES
std::cout << *this << std::endl;
const auto [id_parts, cards] = dump_unique_id_parts();
std::cout << "id is: " << id << ", id parts are: ";
for (auto const & part: id_parts) {
std::cout << part << " ";
}
std::cout << ", encoded cards are ";
for (auto const & part: cards) {
std::cout << part << " ";
}
std::cout << ", probability is ";
print_probability(std::cout, probability);
std::cout << "\n" << std::endl;
#endif
if (_position_tablebase.contains(id)) if (_position_tablebase.contains(id))
{ {
ASSERT(_position_tablebase[id] == probability); ASSERT(_position_tablebase[id] == probability);