Advertisement
Guest User

Untitled

a guest
Jun 9th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form
  2.  
  3. Dim intComputerThrow AsInteger
  4. Const intROCK As Integer = 1
  5. Const intPAPER As Integer = 2
  6. Const intSCISSORS As Integer = 3
  7.  
  8.     Private Function newnub()
  9.         'Generate computer throw
  10.         Randomize()
  11.         intComputerThrow = Int(3 * Rnd()) + 1
  12.         Return intComputerThrow
  13.     End Function
  14.  
  15.     Private Sub btnGo_Click(sender As Object, e As EventArgs_ Handles btnGo.Click
  16.  
  17.         'Runs Function newnub, generating computer throw
  18.         intComputerThrow = newnub()
  19.    
  20.         'Code if Rock is selected
  21.         If me.radRockChecked And intComputerThrow = intROCK Then
  22.             Me.lblWinner.Text = "Computer throws Rock. It's a draw"
  23.         ElseIf Me.radRockChecked And intComputerThrow = intPAPER Then
  24.             Me.lblWinner.Text = "Computer throws Paper. Computer Wins!"
  25.         ElseIf Me.radRockChecked And intComputerThrow = intSCISSORS Then
  26.             Me.lblWinner.Text = "Computer throws Scissors. You Win!"
  27.         End If
  28.  
  29.         'Code if Paper is selected
  30.         If me.radPaperChecked And intComputerThrow = intROCK Then
  31.             Me.lblWinner.Text = "Computer throws Rock. You Win!"
  32.         ElseIf Me.radPaperChecked And intComputerThrow = intPAPER Then
  33.             Me.lblWinner.Text = "Computer throws Paper. It's a draw!"
  34.         ElseIf Me.radPaperChecked And intComputerThrow = intSCISSORS Then
  35.             Me.lblWinner.Text = "Computer throws Scissors. Computer Wins!"
  36.         End If
  37.  
  38.         'Code if Scissors is selected
  39.         If me.radScissorsChecked And intComputerThrow = intROCK Then
  40.             Me.lblWinner.Text = "Computer throws Rock. Computer Wins!"
  41.         ElseIf Me.radScissorsChecked And intComputerThrow = intPAPER Then
  42.             Me.lblWinner.Text = "Computer throws Paper. You Win!!"
  43.         ElseIf Me.radScissorsChecked And intComputerThrow = intSCISSORS Then
  44.             Me.lblWinner.Text = "Computer throws Scissors. It's a draw!"
  45.         End If
  46.  
  47.     End Sub
  48.  
  49.     Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
  50.         Me.Close()
  51.     End Sub
  52.  
  53. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement