Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim AiTeam = Whosup
- Public Function Did_Any_Player_Win()
- ' This will check all the boxes to see if theres any match
- '=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-
- ' ROW SELECTION! ROW 1, ROW 2 ROW 3
- ' Row 1
- If gameboard_1_1.Text = "X" And gameboard_1_2.Text = "X" And gameboard_1_3.Text = "X" Then
- ' Check if X Won on Row 1
- ' Winning text turn yellow
- gameboard_1_1.ForeColor = Color.Yellow
- gameboard_1_2.ForeColor = Color.Yellow
- gameboard_1_3.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_1_1.Text = "O" And gameboard_1_2.Text = "O" And gameboard_1_3.Text = "O" Then
- ' Check If O Won on row 1
- ' Winning text turn yellow
- gameboard_1_1.ForeColor = Color.Yellow
- gameboard_1_2.ForeColor = Color.Yellow
- gameboard_1_3.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- ' Row 2
- If gameboard_2_1.Text = "X" And gameboard_2_2.Text = "X" And gameboard_2_3.Text = "X" Then
- ' Check if X Won on Row 2
- ' Winning text turn yellow
- gameboard_2_1.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_2_3.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_2_1.Text = "O" And gameboard_2_2.Text = "O" And gameboard_2_3.Text = "O" Then
- ' Check If O Won on row 2
- ' Winning text turn yellow
- gameboard_2_1.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_2_3.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- ' Row 3
- If gameboard_3_1.Text = "X" And gameboard_3_2.Text = "X" And gameboard_3_3.Text = "X" Then
- ' Check if X Won on Row 2
- ' Winning text turn yellow
- gameboard_3_1.ForeColor = Color.Yellow
- gameboard_3_2.ForeColor = Color.Yellow
- gameboard_3_3.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_3_1.Text = "O" And gameboard_3_2.Text = "O" And gameboard_3_3.Text = "O" Then
- ' Check If O Won on row 2
- ' Winning text turn yellow
- gameboard_3_1.ForeColor = Color.Yellow
- gameboard_3_2.ForeColor = Color.Yellow
- gameboard_3_3.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- ' END ROW CHECKING!
- '=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-
- ' COLUM SELECTION! COLUM 1, COLUM 2 COLUM 3
- If gameboard_1_1.Text = "X" And gameboard_2_1.Text = "X" And gameboard_3_1.Text = "X" Then
- ' Check if X Won on Colum 1
- ' Winning text turn yellow
- gameboard_1_1.ForeColor = Color.Yellow
- gameboard_2_1.ForeColor = Color.Yellow
- gameboard_3_1.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_1_1.Text = "O" And gameboard_2_1.Text = "O" And gameboard_3_1.Text = "O" Then
- ' Check If O Won on Colum 2
- ' Winning text turn yellow
- gameboard_1_1.ForeColor = Color.Yellow
- gameboard_2_1.ForeColor = Color.Yellow
- gameboard_3_1.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- If gameboard_1_2.Text = "X" And gameboard_2_2.Text = "X" And gameboard_3_2.Text = "X" Then
- ' Check if X Won on Colum 2
- ' Winning text turn yellow
- gameboard_1_2.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_3_2.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_1_2.Text = "O" And gameboard_2_2.Text = "O" And gameboard_3_2.Text = "O" Then
- ' Check If O Won on Colum 2
- ' Winning text turn yellow
- gameboard_1_2.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_3_2.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- If gameboard_1_3.Text = "X" And gameboard_2_3.Text = "X" And gameboard_3_3.Text = "X" Then
- ' Check if X Won on Colum 3
- ' Winning text turn yellow
- gameboard_1_3.ForeColor = Color.Yellow
- gameboard_2_3.ForeColor = Color.Yellow
- gameboard_3_3.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_1_3.Text = "O" And gameboard_2_3.Text = "O" And gameboard_3_3.Text = "O" Then
- ' Check If O Won on Colum 3
- ' Winning text turn yellow
- gameboard_1_3.ForeColor = Color.Yellow
- gameboard_2_3.ForeColor = Color.Yellow
- gameboard_3_3.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- ' END COLUM CHECKING!
- '=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-
- ' Diagonal SELECTION! Diagonal 1, Diagonal 2
- If gameboard_1_1.Text = "X" And gameboard_2_2.Text = "X" And gameboard_3_3.Text = "X" Then
- ' Check if X Won on Diagonal 1
- ' Winning text turn yellow
- gameboard_1_1.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_3_3.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_1_1.Text = "O" And gameboard_2_2.Text = "O" And gameboard_3_3.Text = "O" Then
- ' Check If O Won on Diagonal 1
- ' Winning text turn yellow
- gameboard_1_1.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_3_3.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- If gameboard_1_3.Text = "X" And gameboard_2_2.Text = "X" And gameboard_3_1.Text = "X" Then
- ' Check if X Won on Diagonal 2
- ' Winning text turn yellow
- gameboard_1_3.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_3_1.ForeColor = Color.Yellow
- ' announce the winning of X
- Return "WIN X"
- ElseIf gameboard_1_3.Text = "O" And gameboard_2_2.Text = "O" And gameboard_3_1.Text = "O" Then
- ' Check If O Won on Diagonal 2
- ' Winning text turn yellow
- gameboard_1_3.ForeColor = Color.Yellow
- gameboard_2_2.ForeColor = Color.Yellow
- gameboard_3_1.ForeColor = Color.Yellow
- ' announce the winning of O
- Return "WIN O"
- End If
- ' END DIAGONAL CHECKING!
- '=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-
- ' DRAW SELECTION!
- If gameboard_1_1.Text = spaces = False Then
- If gameboard_1_2.Text = spaces = False Then
- If gameboard_1_3.Text = spaces = False Then
- If gameboard_2_1.Text = spaces = False Then
- If gameboard_2_2.Text = spaces = False Then
- If gameboard_2_3.Text = spaces = False Then
- If gameboard_3_1.Text = spaces = False Then
- If gameboard_3_2.Text = spaces = False Then
- If gameboard_3_3.Text = spaces = False Then
- Return "DRAW!"
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- ' END DRAW CHECKING!
- '=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-
- ' IF NO ONE HAS WON yet
- Return "no one won yet"
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement