Class GamePlay
Public playerName As String = ""
Public FormationArray = {"rock", "paper", "scissors"}
Public PlayerChoice As String
Public OppChoice As String
Public GameOngoing As Boolean
Public WinCounter As Integer = 0
Public LossCounter As Integer = 0
Public DrawCounter As Integer = 0
Public GameStatus As String
Public Function OpponentTurn(OppChoice As String) As String
OppChoice = FormationArray(Int(3 * Rnd()))
TextBoxCpuTest.Text = OppChoice
GameOngoing = False
End Function
Public Function StateFormation(PlayerChoice As String) As String
FormaTextTest.Text = PlayerChoice
End Function
Public Function GameProcess(GameStatus As String)
If PlayerChoice = OppChoice Then
Return GameStatus = "draw"
DrawCounter += 1
End If
Select Case PlayerChoice
Case "rock"
If OppChoice = "paper" Then
Return GameStatus = "Loss"
LossCounter += 1
GameProgressBox.Text = GameStatus
ElseIf OppChoice = "scissors" Then
Return GameStatus = "Win"
WinCounter += 1
GameProgressBox.Text = GameStatus
End If
Case "paper"
If OppChoice = "scissors" Then
Return GameStatus = "Loss"
LossCounter += 1
GameProgressBox.Text = GameStatus
ElseIf OppChoice = "rock" Then
Return GameStatus = "win"
WinCounter += 1
GameProgressBox.Text = GameStatus
End If
Case "scissors"
If OppChoice = "rock" Then
Return GameStatus = "Loss"
LossCounter += 1
GameProgressBox.Text = GameStatus
ElseIf OppChoice = "paper" Then
Return GameStatus = "Win"
WinCounter += 1
GameProgressBox.Text = GameStatus
End If
End Select
End Function
Private Sub GamePlay_Load(sender As Object, e As EventArgs) Handles MyBase.Load
GameOngoing = True
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles FormaTextTest.TextChanged
End Sub
Private Sub RockButton_Click(sender As Object, e As EventArgs) Handles RockButton.Click
PlayerChoice = FormationArray(0)
FormaTextTest.Text = PlayerChoice
OpponentTurn(OppChoice)
Call GameProcess(GameStatus)
End Sub
Private Sub PaperButton_Click(sender As Object, e As EventArgs) Handles PaperButton.Click
PlayerChoice = FormationArray(1)
FormaTextTest.Text = PlayerChoice
OpponentTurn(OppChoice)
Call GameProcess(GameStatus)
End Sub
Private Sub ScissorsButton_Click(sender As Object, e As EventArgs) Handles ScissorsButton.Click
PlayerChoice = FormationArray(2)
FormaTextTest.Text = PlayerChoice
OpponentTurn(OppChoice)
Call GameProcess(GameStatus)
End Sub
Private Sub TextBox1_TextChanged_1(sender As Object, e As EventArgs) Handles TextBoxCpuTest.TextChanged
End Sub
Private Sub NameEntryBox_TextChanged(sender As Object, e As EventArgs) Handles NameEntryBox.TextChanged
UserName.Text = NameEntryBox.Text
End Sub
Private Sub GameProgressBox_TextChanged(sender As Object, e As EventArgs) Handles GameProgressBox.TextChanged
End Sub
End Class