I'm starting to write a video poker program and I'm running into some issues.
I have a Hold function as you can see below:
void Game::Hold( bool& choice )
{
if( choice == true )
{
Console::BackgroundColor(Red);
Console::ForegroundColor(Black);
cout << "HOLD";
Console::BackgroundColor(Black);
Console::ForegroundColor(Red);
}
else
cout << "HOLD";
}
This functions allows me to block out the text so the player knows which cards are selected and which are not. The problem I'm having is that the first and last "Holds" wont block off if being held.
So far-this is my code that is calling the Hold
function:
void Game::Play( void )
{
Menu();
Console::Clear();
Deck nGame;
nGame.Shuffle();
Game Hand;
Card currentHand[ 5 ];
bool p_Hold[ 5 ] = { 0 , 0 , 0, 0, 0 };
for( int i = 0; i < 5; i++ )
currentHand[ i ] = nGame.Draw();
cout << "Type in which cards you would like to hold. Type \"d\" when done.\n\n";
char uChoice[ 5 ] = {};
for( int i = 0; i < 5; i++ )
{
if( uChoice[ i ] == 'd' )
break;
for( int i = 0; i < 5; i++ )
cout << " " << currentHand[ i ] << " ";
cout << endl;
for( int i = 0; i < 5; i++ )
{
cout << " ";
Hand.Hold( p_Hold[ i ] );
cout << " ";
}
cout << "\n\n\nWould you like to hold Card " << i + 1 << "? (1 = Yes/0 = No): ";
cin.get( uChoice[ i ] );
cin.clear();
cin.ignore( INT_MAX, '\n' );
cout << endl;
if( cin.good() )
{
for( int i = 0; i < 5; i++ )
{
if( uChoice[ i ] == '1' )
p_Hold[ i ] = true;
else
p_Hold[ i ] = false;
}
}
}
}