All pastes #255881 Raw Edit

Miscellany

public text v1 · immutable
#255881 ·published 2006-11-23 14:09 UTC
rendered paste body
'Rob Arseneault
'HTHS
'November 22
Option Explicit
Dim curDealer1 As Currency
Dim curDealer2 As Currency
Dim curDealer3 As Currency
Dim curDTotal As Currency
Dim curPlayer As Currency
Dim curPlayerMoney As Currency


Private Sub cmdClose_Click()
    Unload Me       'Closes program
End Sub

Private Sub cmdHitMe_Click()
    curPlayer = Int(10 * Rnd + 1)
    curPlayerMoney = curPlayerMoney + curPlayer
    lblPlayer.Caption = curPlayer
    lblPTotal.Caption = curPlayerMoney
    
    If curPlayerMoney > 21 Then
    MsgBox "You have busted! You lose!", vbOKOnly, "21" 'Tells you if you bust
    curDealer1 = 0                                      'Restarts game
    curDealer2 = 0
    curDealer3 = 0
    curPlayerMoney = 0
    
    lblDealer1.Caption = ""
    lblDealer2.Caption = ""
    lblDealer3.Caption = ""
    lblPlayer.Caption = ""
    lblPTotal.Caption = ""
    
    lblDTotal.Caption = ""
    cmdStart.Visible = True
    cmdHitMe.Visible = True
    End If
   
       
    
End Sub


Private Sub cmdStart_Click()
    cmdHitMe.Visible = True             'Makes HitMe button visible
    cmdStart.Visible = False            'Makes Start button not visible
    
    curDealer1 = Int(10 * Rnd + 1)      'Randomizes dealers cards
    curDealer2 = Int(10 * Rnd + 1)      'Randomizes dealers cards
    curDealer3 = Int(10 * Rnd + 1)      'Randomizes dealers cards
    
    lblDealer1.Caption = "**"           'Makes dealers cards not visible
    lblDealer2.Caption = "**"
    lblDealer3.Caption = "**"
    
End Sub

Private Sub cmdStay_Click()
    
    curDTotal = curDealer1 + curDealer2 + curDealer3
    lblDealer1.Caption = curDealer1
    lblDealer2.Caption = curDealer2
    lblDealer3.Caption = curDealer3
    
    lblDTotal.Caption = curDTotal
    
        If curDTotal > 21 Then
    MsgBox "Dealer busts. You Win!", vbOKOnly, "21"             'Tells you if computer busts
    curDealer1 = 0                                              'Restarts game
    curDealer2 = 0
    curDealer3 = 0
    curPlayerMoney = 0
    
    lblDealer1.Caption = ""
    lblDealer2.Caption = ""
    lblDealer3.Caption = ""
    lblPlayer.Caption = ""
    lblPTotal.Caption = ""
    
    lblDTotal.Caption = ""
    cmdStart.Visible = True
    cmdHitMe.Visible = True
        ElseIf curPlayerMoney > curDTotal Then
    MsgBox "You have more points than the Dealer. You Win!", vbOKOnly, "21" 'Tells if you have more points than dealer
    curDealer1 = 0                                                          'Restarts game
    curDealer2 = 0
    curDealer3 = 0
    curPlayerMoney = 0
    
    lblDealer1.Caption = ""
    lblDealer2.Caption = ""
    lblDealer3.Caption = ""
    lblPlayer.Caption = ""
    lblPTotal.Caption = ""
    
    lblDTotal.Caption = ""
    cmdStart.Visible = True
    cmdHitMe.Visible = True
        ElseIf curPlayerMoney < curDTotal Then
    MsgBox "The dealer has more points than you. You Lose!", vbOKOnly, "21" 'Tells if dealer has more points than you
    curDealer1 = 0                                                          'Restarts game
    curDealer2 = 0
    curDealer3 = 0
    curPlayerMoney = 0
    
    lblDealer1.Caption = ""
    lblDealer2.Caption = ""
    lblDealer3.Caption = ""
    lblPlayer.Caption = ""
    lblPTotal.Caption = ""
    
    lblDTotal.Caption = ""
    cmdStart.Visible = True
    cmdHitMe.Visible = True
        ElseIf curPlayerMoney = curDTotal Then
    MsgBox "You have the same amount of points as the dealer. Dealer Wins!", vbOKOnly, "21" 'Tells if the game is tied
    curDealer1 = 0                                                                        'Restarts game
    curDealer2 = 0
    curDealer3 = 0
    curPlayerMoney = 0
    
    lblDealer1.Caption = ""
    lblDealer2.Caption = ""
    lblDealer3.Caption = ""
    lblPlayer.Caption = ""
    lblPTotal.Caption = ""
    
    lblDTotal.Caption = ""
    cmdStart.Visible = True
    cmdHitMe.Visible = True
    End If
    
    
   
    

End Sub

Private Sub Form_Load()
    Randomize           'Randomizes numbers
End Sub