Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.     Private Sub btn_play_Click(sender As Object, e As EventArgs) Handles btn_play.Click
  3.         Dim computer As Integer
  4.         Dim user As Integer
  5.  
  6.  
  7.         txt_winner.Clear()
  8.  
  9.         Randomize()
  10.  
  11.         computer = CInt(Int((3 * Rnd()) + 1))
  12.  
  13.         If computer = 1 Then
  14.             txt_computer.Text = "Rock"
  15.         End If
  16.  
  17.         If computer = 2 Then
  18.             txt_computer.Text = "Paper"
  19.         End If
  20.  
  21.         If computer = 3 Then
  22.             txt_computer.Text = "Scissors"
  23.         End If
  24.  
  25.         If RadioButton1.Checked = True Then
  26.             user = 1
  27.         End If
  28.  
  29.         If RadioButton2.Checked = True Then
  30.             user = 2
  31.         End If
  32.  
  33.         If RadioButton3.Checked = True Then
  34.             user = 3
  35.         End If
  36.  
  37.         'who wins
  38.  
  39.         'Draw
  40.  
  41.         If user = computer Then
  42.             txt_winner.Text = "Draw Game"
  43.         End If
  44.  
  45.         'User win combinations ..............
  46.  
  47.         If (user = 1) And (computer = 3) Then
  48.             txt_winner.Text = "User Wins... Rock beats Scissors"
  49.         End If
  50.  
  51.         If (user = 3) And (computer = 2) Then
  52.             txt_winner.Text = "User Wins... Scissors beats Paper"
  53.         End If
  54.  
  55.         If (user = 2) And (computer = 1) Then
  56.             txt_winner.Text = "User Wins... Paper beats Rock"
  57.         End If
  58.  
  59.         'Computer win combinations ..............
  60.  
  61.         If (user = 3) And (computer = 1) Then
  62.             txt_winner.Text = "Computer Wins... Rock beats Scissors"
  63.         End If
  64.  
  65.         If (user = 2) And (computer = 3) Then
  66.             txt_winner.Text = "Computer Wins... Scissors beats Paper"
  67.         End If
  68.  
  69.         If (user = 1) And (computer = 2) Then
  70.             txt_winner.Text = "Computer Wins... Paper beats Rock"
  71.         End If
  72.  
  73.     End Sub
  74. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement