Replace this with a switch statement, make it easier to read
parent
2860c9c622
commit
d4eff0d774
|
@ -141,35 +141,28 @@
|
||||||
RaiseEvent EndGame(winMessage)
|
RaiseEvent EndGame(winMessage)
|
||||||
End Sub
|
End Sub
|
||||||
Function GetResults()
|
Function GetResults()
|
||||||
If dealer.winType = WinCondition.Blackjack Then
|
Select Case True
|
||||||
If player.winType = WinCondition.Blackjack Then
|
Case dealer.winType = WinCondition.Blackjack
|
||||||
Return "Player ties with Blackjack!"
|
If player.winType = WinCondition.Blackjack Then
|
||||||
Else
|
Return "Player ties with Blackjack!"
|
||||||
Return "Dealer wins with Blackjack!"
|
Else
|
||||||
End If
|
Return "Dealer wins with Blackjack!"
|
||||||
End If
|
End If
|
||||||
If player.winType = WinCondition.Blackjack Then
|
Case player.winType = WinCondition.Blackjack
|
||||||
Return "Player wins with Blackjack!"
|
Return "Player wins with Blackjack!"
|
||||||
End If
|
Case player.winType = WinCondition.FiveCard
|
||||||
If player.winType = WinCondition.FiveCard Then
|
Return "Player wins with Five Card Charlie!"
|
||||||
Return "Player wins with Five Card Charlie!"
|
Case player.winType = WinCondition.Bust
|
||||||
End If
|
Return "Player busts!"
|
||||||
If player.winType = WinCondition.Bust Then
|
Case dealer.winType = WinCondition.Bust
|
||||||
Return "Player busts!"
|
Return "Dealer busts!"
|
||||||
End If
|
Case player.total > dealer.total
|
||||||
If dealer.winType = WinCondition.Bust Then
|
Return "Player wins with a total of " & player.total.ToString() & "!"
|
||||||
Return "Dealer busts!"
|
Case player.total = dealer.total
|
||||||
End If
|
Return "Tie!"
|
||||||
If player.total > dealer.total Then
|
Case Else
|
||||||
Return "Player wins with total of " + player.total.ToString() + "!"
|
Return "Dealer wins with a total of " & dealer.total.ToString() & "!"
|
||||||
End If
|
End Select
|
||||||
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"
|
|
||||||
End Function
|
End Function
|
||||||
Function CreateDeck() As List(Of Tuple(Of String, String))
|
Function CreateDeck() As List(Of Tuple(Of String, String))
|
||||||
Dim response As New List(Of Tuple(Of String, String))
|
Dim response As New List(Of Tuple(Of String, String))
|
||||||
|
|
Loading…
Reference in New Issue