Support Forums

Full Version: Rock Paper Scissors - stuck, need help finishing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Public Class Form1

Private choice As Int16

Private Sub rockPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rockPictureBox.Click

choice = 1
Call setPlayerPicture(choice)

End Sub

Private Sub paperPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles paperPictureBox.Click

choice = 2
Call setPlayerPicture(choice)

End Sub

Private Sub scissorsPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scissorsPictureBox.Click

choice = 3
Call setPlayerPicture(choice)

End Sub

Private Sub announceWinner()

End Sub

Private Sub setPlayerPicture(ByVal usersPick As Integer)

Select Case usersPick
Case 1
playerPictureBox.Image.FromFile("is.jpg")
Case 2
playerPictureBox.Image.FromFile("paper.jpg")
Case Else
playerPictureBox.Image.FromFile("scissors.jpg")
End Select

End Sub

Private Function pickWinner(ByVal selected As Int16) As Boolean

Dim randomnum As New Random(1, 4)
Dim userWins As Boolean = False

Select Case selected

Case selected > randomnum

Case randomnum > SelectedGridItemChangedEventArgs

Case selected = randomnum

Case Else

End Select

pickWinner = userWins

End Function


End Class

(12-02-2011, 08:33 AM)IamMr_Bean Wrote: [ -> ]Public Class Form1

Private choice As Int16

Private Sub rockPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rockPictureBox.Click

choice = 1
Call setPlayerPicture(choice)

End Sub

Private Sub paperPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles paperPictureBox.Click

choice = 2
Call setPlayerPicture(choice)

End Sub

Private Sub scissorsPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scissorsPictureBox.Click

choice = 3
Call setPlayerPicture(choice)

End Sub

Private Sub announceWinner()

End Sub

Private Sub setPlayerPicture(ByVal usersPick As Integer)

Select Case usersPick
Case 1
playerPictureBox.Image.FromFile("is.jpg")
Case 2
playerPictureBox.Image.FromFile("paper.jpg")
Case Else
playerPictureBox.Image.FromFile("scissors.jpg")
End Select

End Sub

Private Function pickWinner(ByVal selected As Int16) As Boolean

Dim randomnum As New Random(1, 4)
Dim userWins As Boolean = False

Select Case selected

Case selected > randomnum

Case randomnum > SelectedGridItemChangedEventArgs

Case selected = randomnum

Case Else

End Select

pickWinner = userWins

End Function


End Class

The form is set up with so the player picks a picture from three choices (rock, paper, or scissors) and then it appears in the playerPictureBox. At the same time you pick a picture, the computer is to randomly select one of those pictures itself. You then have the rules of rock beating scissors, paper beating rock, and scissors beating paper. So I got all of this, but I really would love to know what to do next, and to understand it. Thanks.
That is really simple, but I would like to do it my way. Thanks though!
yeah watch that video bro! :')
Next time could you use code tags please? Thank you.