@@ -22,15 +22,19 @@ void Dealer::updateMeanAndVariance(void) {
2222
2323
2424void Dealer::prepareReport (void ) {
25-
25+
26+ // TODO: if n_hand is one the error is NaN
27+ /*
2628 if (n_hand <= 1) {
2729 return;
2830 }
31+ */
2932
3033 // we need to update these statistics after the last played hand
3134 updateMeanAndVariance ();
3235
33- double error = error_standard_deviations * sqrt (playerStats.variance / (double ) n_hand);
36+ double total = static_cast <double >(n_hand);
37+ double error = error_standard_deviations * sqrt (playerStats.variance / total);
3438
3539 int precision = 0 ;
3640 if (error > 0 ) {
@@ -59,16 +63,34 @@ void Dealer::prepareReport(void) {
5963 report.push_back (reportItem (2 , " hands" , n_hand));
6064 report.push_back (reportItem (2 , " bankroll" , playerStats.bankroll ));
6165
62- report.push_back (reportItem (3 , " busts_player" , playerStats.bustsPlayer / (double ) n_hand));
63- report.push_back (reportItem (3 , " busts_dealer" , playerStats.bustsDealer / (double ) (n_hand - playerStats.bustsPlayerAllHands - playerStats.blackjacksDealer )));
66+
67+ report.push_back (reportItem (3 , " busts_player_n" , playerStats.bustsPlayer ));
68+ report.push_back (reportItem (3 , " busts_dealer_n" , playerStats.bustsDealer ));
69+
70+ report.push_back (reportItem (3 , " busts_player" , playerStats.bustsPlayer / total));
71+ report.push_back (reportItem (3 , " busts_player_nobj" , playerStats.bustsPlayer / (total - playerStats.blackjacksPlayer )));
72+
73+ double b1 = playerStats.bustsDealer / total;
74+ double b2 = playerStats.bustsDealer / (total - playerStats.bustsPlayerAllHands );
75+ double b3 = playerStats.bustsDealer / (total - playerStats.blackjacksDealer );
76+ double b4 = playerStats.bustsDealer / (total - playerStats.bustsPlayerAllHands - playerStats.blackjacksDealer );
77+
78+ // double b2 = b1 * (1 + (double)playerStats.bustsPlayerAllHands/total);
79+ // double b3 = b2 * (1 + (double)playerStats.blackjacksDealer/total);
80+ report.push_back (reportItem (3 , " busts_dealer1" , b1));
81+ // report.push_back(reportItem(3, "busts_dealer2old", playerStats.bustsDealer / (double) (n_hand - playerStats.bustsPlayerAllHands)));
82+ report.push_back (reportItem (3 , " busts_dealer2" , b2));
83+ // report.push_back(reportItem(3, "busts_dealer3old", playerStats.bustsDealer / (double) (n_hand - playerStats.bustsPlayerAllHands - playerStats.blackjacksDealer)));
84+ report.push_back (reportItem (3 , " busts_dealer3" , b3));
85+ report.push_back (reportItem (3 , " busts_dealer3" , b4));
6486
65- report.push_back (reportItem (3 , " wins" , playerStats.wins / ( double ) n_hand ));
66- report.push_back (reportItem (3 , " pushes" , playerStats.pushes / ( double ) n_hand ));
67- report.push_back (reportItem (3 , " losses" , playerStats.losses / ( double ) n_hand ));
87+ report.push_back (reportItem (3 , " wins" , playerStats.wins / total ));
88+ report.push_back (reportItem (3 , " pushes" , playerStats.pushes / total ));
89+ report.push_back (reportItem (3 , " losses" , playerStats.losses / total ));
6890
6991 report.push_back (reportItem (4 , " total_money_waged" , playerStats.totalMoneyWaged ));
70- report.push_back (reportItem (4 , " blackjacks_player" , playerStats.blackjacksPlayer / ( double ) n_hand ));
71- report.push_back (reportItem (4 , " blackjacks_dealer" , playerStats.blackjacksDealer / ( double ) n_hand ));
92+ report.push_back (reportItem (4 , " blackjacks_player" , playerStats.blackjacksPlayer / total ));
93+ report.push_back (reportItem (4 , " blackjacks_dealer" , playerStats.blackjacksDealer / total ));
7294// if (playerStats.bustsPlayerAllHands != 0) {
7395 report.push_back (reportItem (4 , " blackjacks_dealer_real1" , playerStats.blackjacksDealer / (double ) (n_hand - playerStats.bustsPlayerAllHands )));
7496 report.push_back (reportItem (4 , " blackjacks_dealer_real2" , playerStats.blackjacksDealer / (double ) (n_hand - playerStats.bustsPlayer )));
@@ -83,9 +105,9 @@ void Dealer::prepareReport(void) {
83105
84106int Dealer::writeReportYAML (void ) {
85107
86- if (n_hand <= 1 ) {
87- return 0 ;
88- }
108+ // if (n_hand <= 1) {
109+ // return 0;
110+ // }
89111
90112
91113 std::ostream* out = &std::cerr;
0 commit comments