Support Forums
Rock Paper Scissors - stuck, need help finishing - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: Rock Paper Scissors - stuck, need help finishing (/showthread.php?tid=23554)



Rock Paper Scissors - stuck, need help finishing - IamMr_Bean - 12-02-2011

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.


RE: Rock Paper Scissors - stuck, need help finishing - BreShiE - 12-02-2011




RE: Rock Paper Scissors - stuck, need help finishing - IamMr_Bean - 12-02-2011

That is really simple, but I would like to do it my way. Thanks though!


RE: Rock Paper Scissors - stuck, need help finishing - Weezч™ - 12-02-2011

yeah watch that video bro! :')


RE: Rock Paper Scissors - stuck, need help finishing - HostGap - 12-03-2011

Next time could you use code tags please? Thank you.