Game/CompareScore.ps1
$playerScore = $game.MeasureScore($game.PlayerHand) $dealerScore = $game.MeasureScore($game.DealerHand) if ($playerScore.RealTotal -gt 21) { 'Player Busts' } elseif ($dealerScore.RealTotal -gt 21) { # Dealer Busts 'Dealer Busts' } elseif ($playerScore.SoftTotal -eq 21 -and $game.PlayerHand.Count -eq 2) { 'Player Blackjack !' } elseif ($dealerScore.HardTotal -eq 21 -and $game.DealerHand.Count -eq 2) { 'Dealer Blackjack !' } else { $ps = $playerScore.RealTotal $ds = $dealerScore.RealTotal if ($ps -gt $ds) { "Player Wins ! [ $ps > $ds ]" } elseif ($ps -eq $ds) { "Push" } else { "Dealer Wins :-( [ $ps < $ds ]" } } |