Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form
- Dim intComputerThrow AsInteger
- Const intROCK As Integer = 1
- Const intPAPER As Integer = 2
- Const intSCISSORS As Integer = 3
- Private Function newnub()
- 'Generate computer throw
- Randomize()
- intComputerThrow = Int(3 * Rnd()) + 1
- Return intComputerThrow
- End Function
- Private Sub btnGo_Click(sender As Object, e As EventArgs_ Handles btnGo.Click
- 'Runs Function newnub, generating computer throw
- intComputerThrow = newnub()
- 'Code if Rock is selected
- If me.radRockChecked And intComputerThrow = intROCK Then
- Me.lblWinner.Text = "Computer throws Rock. It's a draw"
- ElseIf Me.radRockChecked And intComputerThrow = intPAPER Then
- Me.lblWinner.Text = "Computer throws Paper. Computer Wins!"
- ElseIf Me.radRockChecked And intComputerThrow = intSCISSORS Then
- Me.lblWinner.Text = "Computer throws Scissors. You Win!"
- End If
- 'Code if Paper is selected
- If me.radPaperChecked And intComputerThrow = intROCK Then
- Me.lblWinner.Text = "Computer throws Rock. You Win!"
- ElseIf Me.radPaperChecked And intComputerThrow = intPAPER Then
- Me.lblWinner.Text = "Computer throws Paper. It's a draw!"
- ElseIf Me.radPaperChecked And intComputerThrow = intSCISSORS Then
- Me.lblWinner.Text = "Computer throws Scissors. Computer Wins!"
- End If
- 'Code if Scissors is selected
- If me.radScissorsChecked And intComputerThrow = intROCK Then
- Me.lblWinner.Text = "Computer throws Rock. Computer Wins!"
- ElseIf Me.radScissorsChecked And intComputerThrow = intPAPER Then
- Me.lblWinner.Text = "Computer throws Paper. You Win!!"
- ElseIf Me.radScissorsChecked And intComputerThrow = intSCISSORS Then
- Me.lblWinner.Text = "Computer throws Scissors. It's a draw!"
- End If
- End Sub
- Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
- Me.Close()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement