The document describes a rock-paper-scissors game program where:
1) The computer randomly selects rock, paper, or scissors and the results are compared to the player's selection.
2) The program displays who won or if it was a draw depending on the combinations.
3) A "New Game" option resets the selections and display, while an "Exit" option closes the program.
The document describes a rock-paper-scissors game program where:
1) The computer randomly selects rock, paper, or scissors and the results are compared to the player's selection.
2) The program displays who won or if it was a draw depending on the combinations.
3) A "New Game" option resets the selections and display, while an "Exit" option closes the program.
The document describes a rock-paper-scissors game program where:
1) The computer randomly selects rock, paper, or scissors and the results are compared to the player's selection.
2) The program displays who won or if it was a draw depending on the combinations.
3) A "New Game" option resets the selections and display, while an "Exit" option closes the program.
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnGo.Click Const ROCK As Integer = 1 Const PAPER As Integer = 2 Const SCISSORS As Integer = 3 Dim computerThrow As Integer
Randomize() computerThrow = Int(3 * Rnd() + 1)
If radRock.Checked And computerThrow = ROCK Then
lb1Winner.Text = "Computer throws Rock. It's a draw!" ElseIf radRock.Checked And computerThrow = PAPER Then lb1Winner.Text = "Computer throws Paper. Computer wins!" ElseIf radRock.Checked And computerThrow = SCISSORS Then lb1Winner.Text = "Computer throws Scissors. You win!" End If
If radPaper.Checked And computerThrow = ROCK Then
lb1Winner.Text = "Computer throws Rock. You Win!" ElseIf radPaper.Checked And computerThrow = PAPER Then lb1Winner.Text = "Computer throws Paper. It's a draw!" ElseIf radPaper.Checked And computerThrow = SCISSORS Then lb1Winner.Text = "Computer throws Scissors. Computer wins!" End If
If radScissors.Checked And computerThrow = ROCK Then
lb1Winner.Text = "Computer throws Rock. Computer wins!" ElseIf radScissors.Checked And computerThrow = PAPER Then lb1Winner.Text = "Computer throws Paper. You win!" ElseIf radScissors.Checked And computerThrow = SCISSORS Then lb1Winner.Text = "Computer throws Scissors. It's a draw!" End If End Sub
Private Sub NewGameToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NewGameToolStripMenuItem.Click lb1Winner.Text = Nothing radRock.Checked = False radPaper.Checked = False radScissors.Checked = False End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitToolStripMenuItem.Click Application.Exit() End Sub End Class
Imports Imports Partial Class Inherits Dim As New Dim As New Dim As New Dim As String Dim As Boolean Dim As New Protected Sub Byval As Object Byval As Handles Me If Not Then