Game/ShowScoreAndControls.ps1

$playerScore = $game.MeasureScore($game.PlayerHand)
$hardTotal, $softTotal = $playerScore.HardTotal, $playerScore.SoftTotal

$scoreMessage = 
    if ($hardTotal -ne $softTotal) {
        if ($softTotal -eq 21) {
            "Blackjack!"
        } 
        elseif ($hardTotal -ge 21 -and $softTotal -ge 21) {
            "BUST :-(" 
        }
        else {
            "$hardTotal (soft $softTotal)"
        }
    } else {
        $hardTotal
    }

$scoreMessage = @(
    "Bank - $("{0:C}" -f ($Game.Bank -as [int]))"
    "Bet - $("{0:C}" -f ($game.Bet -as [int]))"
    "Hand - $scoreMessage"
    ''
    if ($scoreMessage -eq 'Blackjack!' -or $scoreMessage -eq '21') {
        'SPACE - Next Hand'
    } elseif ($hardTotal -gt 21 -and $softTotal -gt 21) {
        $game.Stand()
        return
    } else {
        'SPACE - Hit Me!',
        'BACKSPACE - Stand'
    }
) -join [Environment]::NewLine


[PSCustomObject]@{
    PSTypeName='PowerArcade.MessageBox';
    Message=$scoreMessage;
    X=$game.Width * .05;
    Y=$game.Height * .4;
    Border=$true
} |
    Out-String -Width 1kb | 
    Write-Host -NoNewline