VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Code for the OLD Paper, Rock, Scissors Game

by Celia (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 9th May 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Code for the OLD Paper, Rock, Scissors Game

API Declarations


'the randomizer for the computer's turn to choose
'WTL is for the select case structure to keep up with the total number of wins, ties and losses


Rate Code for the OLD Paper, Rock, Scissors Game



Randomize
Dim cChoice As Integer
cChoice = Int((3 * Rnd) + 1)
If cChoice = 1 Then
    txtCompChoice.Text = "Paper"
End If
If cChoice = 2 Then
    txtCompChoice.Text = "Rock"
End If

If cChoice = 3 Then
txtCompChoice.Text = "Scissors"
End If

uChoice = 3
txtUserChoice.Text = "Scissors"

If uChoice = cChoice Then
    txtStatus.Text = "Tie!"
    WTL = 1
ElseIf uChoice = 3 And cChoice = 2 Then
    txtStatus.Text = "You Lose, Rock Smashes Scissors!"
    WTL = 3
ElseIf uChoice = 3 And cChoice = 1 Then
    txtStatus.Text = "You Win, Chop, Chop!"
    WTL = 2

End If

Select Case WTL
    Case 1
    Ties = Ties + 1
    lblTies.Caption = "Ties: " & Ties
    Case 2
    Wins = Wins + 1
    lblWins.Caption = "Wins: " & Wins
    Case 3
    Losses = Losses + 1
    lblLosses.Caption = "Losses: " & Losses
End Select
    

End Sub





Download this snippet    Add to My Saved Code

Code for the OLD Paper, Rock, Scissors Game Comments

No comments have been posted about Code for the OLD Paper, Rock, Scissors Game. Why not be the first to post a comment about Code for the OLD Paper, Rock, Scissors Game.

Post your comment

Subject:
Message:
0/1000 characters