VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



IT'S A SIMPLE TIC-TAE-TOE GAME, I DID IT IN 15 MIN WHILE I WAS ON BREAK. ALL YOU NEED JUST A LABEL

by LENNY (1 Submission)
Category: Games
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 6th December 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

IT'S A SIMPLE TIC-TAE-TOE GAME, I DID IT IN 15 MIN WHILE I WAS ON BREAK. ALL YOU NEED JUST A LABEL ARRAY FROM 0 TO 8 .I CALLED IT lblXY. and

Rate IT'S A SIMPLE TIC-TAE-TOE GAME, I DID IT IN 15 MIN WHILE I WAS ON BREAK. ALL YOU NEED JUST A LABEL




End Sub


Private Sub cmdNew_Click()
NEWGAME
End Sub

Private Sub lblXY_Click(Index As Integer)
Static HIT As Integer
Dim Rhit As Integer
If InStr(lblRes.Caption, "WINS") > 0 Then Exit Sub
If lblXY(Index).Caption <> "" Then Exit Sub
If HIT = 0 Then
    lblXY(Index).Caption = UCase("X")
    HIT = 1
Else
    lblXY(Index).Caption = UCase("O")
    HIT = 0
End If
If lblXY(Index).Caption = UCase("X") Then
    lblXY(Index).ForeColor = &HFF&
Else
    lblXY(Index).ForeColor = &HFF0000
End If
CHECKX
CHECKY
End Sub

Public Sub CHECKX()
Dim XY As Integer
Dim COMB As Integer
'FOR X WIN
If lblXY(0).Caption = UCase("X") And lblXY(1).Caption = UCase("X") And lblXY(2).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(3).Caption = UCase("X") And lblXY(4).Caption = UCase("X") And lblXY(5).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(6).Caption = UCase("X") And lblXY(7).Caption = UCase("X") And lblXY(8).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(0).Caption = UCase("X") And lblXY(4).Caption = UCase("X") And lblXY(8).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(2).Caption = UCase("X") And lblXY(4).Caption = UCase("X") And lblXY(6).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(1).Caption = UCase("X") And lblXY(4).Caption = UCase("X") And lblXY(7).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(0).Caption = UCase("X") And lblXY(3).Caption = UCase("X") And lblXY(6).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(1).Caption = UCase("X") And lblXY(4).Caption = UCase("X") And lblXY(7).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
ElseIf lblXY(2).Caption = UCase("X") And lblXY(5).Caption = UCase("X") And lblXY(8).Caption = UCase("X") Then
    lblRes.Caption = "X WINS"
End If
End Sub

Public Sub NEWGAME()
Dim XY As Integer
For XY = 0 To 8
   lblXY(XY).Caption = ""
Next
lblRes.Caption = ""
End Sub

Public Sub CHECKY()
'FOR Y WIN
If lblXY(0).Caption = UCase("O") And lblXY(1).Caption = UCase("O") And lblXY(2).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(3).Caption = UCase("O") And lblXY(4).Caption = UCase("O") And lblXY(5).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(6).Caption = UCase("O") And lblXY(7).Caption = UCase("O") And lblXY(8).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(0).Caption = UCase("O") And lblXY(4).Caption = UCase("O") And lblXY(8).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(2).Caption = UCase("O") And lblXY(4).Caption = UCase("O") And lblXY(6).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(1).Caption = UCase("O") And lblXY(4).Caption = UCase("O") And lblXY(7).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(0).Caption = UCase("O") And lblXY(3).Caption = UCase("O") And lblXY(6).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(1).Caption = UCase("O") And lblXY(4).Caption = UCase("O") And lblXY(7).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
ElseIf lblXY(2).Caption = UCase("O") And lblXY(5).Caption = UCase("O") And lblXY(8).Caption = UCase("O") Then
    lblRes.Caption = "O WINS"
End If
End Sub



Download this snippet    Add to My Saved Code

IT'S A SIMPLE TIC-TAE-TOE GAME, I DID IT IN 15 MIN WHILE I WAS ON BREAK. ALL YOU NEED JUST A LABEL Comments

No comments have been posted about IT'S A SIMPLE TIC-TAE-TOE GAME, I DID IT IN 15 MIN WHILE I WAS ON BREAK. ALL YOU NEED JUST A LABEL . Why not be the first to post a comment about IT'S A SIMPLE TIC-TAE-TOE GAME, I DID IT IN 15 MIN WHILE I WAS ON BREAK. ALL YOU NEED JUST A LABEL .

Post your comment

Subject:
Message:
0/1000 characters