handlingwinner

Handling the Winner

• This section of code will handle the CPU's turn, as well as handling who won the game

• We must first tell the CPU When to hit and when to stand, so we will define what conditions should trigger a stand

• Our code makes it so that if the CPU's value is below 17, it will always hit

• It also checks if the CPU's score is above 21, which then makes the CPU Bust

• After the CPU's turn, we will calculate all possible outcomes for this game

These outcomes include:

• Both CPU & Player Bust -> Draw

• CPU & Player have same score -> Draw

• CPU Score above Players score and didn't bust -> CPU Wins

• Player Score above CPU score and didn't bust -> Player Wins

• Player busts, CPU did not bust -> CPU Wins

• CPU busts, Player did not bust -> Player Wins

• After defining the winner, the player will either lose money or gain money if they win or lose

• If they still have money left, they can continue playing, if not, they will lose.