Last active
August 29, 2015 14:06
-
-
Save jonathanmtran/d1b42e11a7efc41fc150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Class Form1 | |
Dim gCurrentMove As Integer = 0 | |
Private Sub Button1A_Click(sender As Object, e As EventArgs) Handles Button1A.Click | |
' Check to see if the button's text is empty. | |
' If it's not empty, let's not waste our time | |
If Button1A.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
' Set button text to O | |
Button1A.Text = "O" | |
' Set gCurrentMove to 1 | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
' Set button text to X | |
Button1A.Text = "X" | |
' Set gCurrentMove to 0 | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button1B_Click(sender As Object, e As EventArgs) Handles Button1B.Click | |
If Button1B.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button1B.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button1B.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button1C_Click(sender As Object, e As EventArgs) Handles Button1C.Click | |
If Button1C.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button1C.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button1C.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button2A_Click(sender As Object, e As EventArgs) Handles Button2A.Click | |
If Button2A.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button2A.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button2A.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button2B_Click(sender As Object, e As EventArgs) Handles Button2B.Click | |
If Button2B.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button2B.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button2B.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button2C_Click(sender As Object, e As EventArgs) Handles Button2C.Click | |
If Button2C.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button2C.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button2C.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button3A_Click(sender As Object, e As EventArgs) Handles Button3A.Click | |
If Button3A.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button3A.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button3A.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button3B_Click(sender As Object, e As EventArgs) Handles Button3B.Click | |
If Button3B.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button3B.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button3B.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
Private Sub Button3C_Click(sender As Object, e As EventArgs) Handles Button3C.Click | |
If Button3C.Text <> "" Then | |
Return | |
End If | |
If gCurrentMove = 0 Then | |
Button3C.Text = "O" | |
gCurrentMove = 1 | |
ElseIf gCurrentMove = 1 Then | |
Button3C.Text = "X" | |
gCurrentMove = 0 | |
End If | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment