Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rock Paper Scissors - stuck, need help finishing
#1
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.
Reply
#2
Reply
#3
That is really simple, but I would like to do it my way. Thanks though!
Reply
#4
yeah watch that video bro! :')
Reply
#5
Next time could you use code tags please? Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [TuT] Rock, Paper, Scissors Game [VB] Deceive 22 9,870 10-11-2011, 02:05 PM
Last Post: Digital-Punk
  [Source]Simple Rock Paper Scissors Xypher 14 2,299 02-10-2011, 02:29 AM
Last Post: versx

Forum Jump:


Users browsing this thread: 4 Guest(s)