void test_make_choice() { int weights[252][32] = {0}; find_num_ways_get_superset_from_subset(weights); bool available_options[14]; for (int i=1; i<14; i++) available_options[i] = (i == sixes || i==chance || i==yahtzee); int roll[5] = {1,2,5,6,6}; //part 3 adjustment example part_three_predicted_scores weights_part_3[13]; weights_part_3[sixes - 1].score_independent_from_freq = 12; for (int i=2; i<4; i++) weights_part_3[sixes - 1].freq_dependent_scores[i] = 35; weights_part_3[yahtzee - 1].score_independent_from_freq = 23 + 10; weights_part_3[chance - 1].score_independent_from_freq = 2 + 10; CategoryInfo instance = CategoryInfo(); value_of_roll result = instance.make_choice(roll, weights_part_3, available_options, false, 0); assert(result.option == 42); //zero in yahtzee assert(fabs(result.value - 33) <= .001); //now, we change 5 into six, and expect to take sixes roll[2] = 6; result = instance.make_choice(roll, weights_part_3, available_options, false, 0); assert(result.option == sixes); }
void Debug::addCategory(const vpr::DebugCategory& catId) { if ( getLevel() >= vprDBG_VERB_LVL ) { std::cout << "\n[vpr::Debug] Adding category named '" << catId.mName << "' (prefix='" << catId.mPrefix << "', GUID=" << catId.mGuid << ")\n" << " to debug categories: " << &mCategories << " (size=" << mCategories.size() << ")" << std::endl; } mCategories.insert(std::make_pair(catId.mGuid, CategoryInfo(catId.mName, catId.mPrefix, false, false))); if ( getLevel() >= vprDBG_HVERB_LVL ) { std::cout << " new size=" << mCategories.size() << std::endl; debugDump(); } updateAllowedCategories(); if ( getLevel() >= vprDBG_HVERB_LVL ) { debugDump(); } }