Poker Game:
this obviously isnt my full code but heres my problem. currentTurn which is nestled withmy loops is meant to go 0-4 (iNoOfPlayers) and repeat. but once it exits the inner Do-While loop it gets changed from 0 to 1. when it reenters the Loop currentTurn= 2293500.
I'm completely stuck as to why this is.
/*OUTPUT:
Pot:0
Player[0]'s Turn:
Choose: Check[C]\Bet[B]\Fold[F]:
C
Player[1]'s Turn:2 # currentTurn=1
Check[2293500]: # currentTurn=2293500
Pot:0
Player[2293500]'s Turn:
Choose: Check[C]\Bet[B]\Fold[F]:
C
*/
Code:
int startTurn = 0;
int currentTurn = startTurn;
int exit = 0;
while((noWinner() && exit == 0) != 0)
{
shuffleDeck(Deck);
for(i=0 ; i<4 ; i++)
{
deal(i, startTurn);
resetStats();
do
{
currentTurn = currentTurn % iNoOfPlayers;
printf( "Pot:%d\n", pot);
printf( "Player[%d]'s Turn:\n", currentTurn);
choose(currentTurn);
currentTurn = ++currentTurn % iNoOfPlayers;
printf( "Player[%d]'s Turn:%d\n", currentTurn, iNoOfPlayers);
}while(!(equalBets(currentTurn)));
}
startTurn = ++startTurn % iNoOfPlayers;
printf( "StartTurn[%d] Enter 1 to Exit:\n", startTurn);
scanf("%d", &exit);
}
ive omitted various function cos my code is long(and in various files) but this is where the error is (i think).