Black Jack program

I'm pretty burned out on this project...

So how willing would any of you be to scour my project files for problems?

Some details about the problem I am stuck on:
-The current split system (i.e. dividing a player's hand into two if both cards have the same value and doubling the pot for that hand) is causing some kind of segmentation fault.
-The split occurs successfully but afterwards if the player attempts to hit, double, or split again, the program crashes.
-I suspect some kind of out-of-bounds access.
-The related split functions are BJPlayer::split() and BJPlayer_Handler::split().
-In the function BJGame_Flow_Handler::choose_action() and on line 223, the related split functions are called.

Link to project files:
https://github.com/Daleth7/BlackJack

Later on, I will attempt to create a mini-program that will recreate the problem, but I am hoping I just overlooked something and the mistake is not major.

~Daleth~
Last edited on
It doesn't compile
By instance
1
2
        using Hand              = std::vector<Deck::Card_ptr>;
//h/BJPlayer.h:11:47: error: ‘Card_ptr’ is not a member of ‘Deck’ 


http://www.cplusplus.com/forum/general/112111/
Last edited on
Oop sorry. Before I updated it on GitHub, I changed one of the aliases. I must have forgotten to change it in all the files. It should compile now.

The problem with the splitting system persists, however.
In BJGame_Flow_Handler.cpp:230 you have if(!m_p_handle->split(name, hand--))
¿what's the meaning of `hand'?
Assume that hand=0, If the split were successful, you'll have hand=(size_t) -1 and when later trying to

1
2
3
this->choose_action(*iter, hand); //63
//that explodes into
   m_p_handle->last_card(name,hand)->name(); //207 
you'll be dereferencing a null pointer (¿why do you return a null pointer if you are not going to check for it?)


By the way, for the sake of testing, establish an order for the deck, and remove the fat in the user interface
Last edited on
Topic archived. No new replies allowed.