Replace this with a switch statement, make it easier to read

master
CrystalMoogle 2023-07-16 16:10:48 +01:00
parent 2860c9c622
commit d4eff0d774
1 changed files with 22 additions and 29 deletions

View File

@ -141,35 +141,28 @@
RaiseEvent EndGame(winMessage)
End Sub
Function GetResults()
If dealer.winType = WinCondition.Blackjack Then
If player.winType = WinCondition.Blackjack Then
Return "Player ties with Blackjack!"
Else
Return "Dealer wins with Blackjack!"
End If
End If
If player.winType = WinCondition.Blackjack Then
Return "Player wins with Blackjack!"
End If
If player.winType = WinCondition.FiveCard Then
Return "Player wins with Five Card Charlie!"
End If
If player.winType = WinCondition.Bust Then
Return "Player busts!"
End If
If dealer.winType = WinCondition.Bust Then
Return "Dealer busts!"
End If
If player.total > dealer.total Then
Return "Player wins with total of " + player.total.ToString() + "!"
End If
If player.total = dealer.total Then
Return "Tie!"
End If
If player.total < dealer.total Then
Return "Dealer wins with total of " + dealer.total.ToString() + "!"
End If
Return "error"
Select Case True
Case dealer.winType = WinCondition.Blackjack
If player.winType = WinCondition.Blackjack Then
Return "Player ties with Blackjack!"
Else
Return "Dealer wins with Blackjack!"
End If
Case player.winType = WinCondition.Blackjack
Return "Player wins with Blackjack!"
Case player.winType = WinCondition.FiveCard
Return "Player wins with Five Card Charlie!"
Case player.winType = WinCondition.Bust
Return "Player busts!"
Case dealer.winType = WinCondition.Bust
Return "Dealer busts!"
Case player.total > dealer.total
Return "Player wins with a total of " & player.total.ToString() & "!"
Case player.total = dealer.total
Return "Tie!"
Case Else
Return "Dealer wins with a total of " & dealer.total.ToString() & "!"
End Select
End Function
Function CreateDeck() As List(Of Tuple(Of String, String))
Dim response As New List(Of Tuple(Of String, String))