Tic Tac

0

Posted by admin | Posted in Uncategorized | Posted on 22-08-2006

Tags: , , , , , , , ,

Tic Tac

Personalized Wedding Bridal Shower Kiss Candy Wrappers Labels Favors
Personalized Wedding Bridal Shower Kiss Candy Wrappers Labels Favors
Paypal   US $5.75
Milwaukee 4932352976 Shockwave 50mm PZ2 Pozi Screwdriver Drill Bits x10
Milwaukee 4932352976 Shockwave 50mm PZ2 Pozi Screwdriver Drill Bits x10
Paypal   US $20.53
Tic Tac Toe Set Drinking Game By Studio
Tic Tac Toe Set Drinking Game By Studio
Paypal   US $24.99
15 $1 3 Single Pks of Tic Tac Mints Can Double snacks candy
15 $1 3 Single Pks of Tic Tac Mints Can Double snacks candy
Paypal   US $2.25
25 Kids Party Loot Goodies Bags PInata Fillers Toys Birthday Favours Gifts
25 Kids Party Loot Goodies Bags PInata Fillers Toys Birthday Favours Gifts
Paypal   US $6.31
ADULT TIC TAC TOE DRINKING GAME
ADULT TIC TAC TOE DRINKING GAME
Paypal   US $3.99
DISNEY CARS THE WORLD OF CARS CHECKERS TIC TAC TOE GAME NEW
DISNEY CARS THE WORLD OF CARS CHECKERS TIC TAC TOE GAME NEW
Paypal   US $4.79
108 Graduation Kiss Kisses Candy Wrappers Labels Party Favors Personalized
108 Graduation Kiss Kisses Candy Wrappers Labels Party Favors Personalized
Paypal   US $5.75
50 BOSCH R2 ROBERTSON SQUARE SCREW DRIVER DRILL BITS 2
50 BOSCH R2 ROBERTSON SQUARE SCREW DRIVER DRILL BITS 2
Paypal   US $9.99
Home Essentials Old Fashion Glasses NIB Theme Checkers Dice etc
Home Essentials Old Fashion Glasses NIB Theme Checkers Dice etc
Paypal   US $13.50
DIY Shed Log Cabin Summer House Play House Barn Garage Woodwork Plans CD
DIY Shed Log Cabin Summer House Play House Barn Garage Woodwork Plans CD
Paypal   US $7.10
100 Personalized Tic Tac Wedding Favor Labels
100 Personalized Tic Tac Wedding Favor Labels
Paypal   US $5.99
TIC TAC TOE SHOT GLASS SET
TIC TAC TOE SHOT GLASS SET
Paypal   US $2.00
EXECUTIVE TIC TAC TOE FOR HOME OR OFFICE WOOD BRASS
EXECUTIVE TIC TAC TOE FOR HOME OR OFFICE WOOD BRASS
Paypal   US $18.50
Milwaukee 4932352975 Shockwave 50mm PH2 Pozi Screwdriver Drill Bits x10
Milwaukee 4932352975 Shockwave 50mm PH2 Pozi Screwdriver Drill Bits x10
Paypal   US $20.53
TICTAC Mints Breast Cancer Awareness PINK RIBBON New UNOPENED
TICTAC Mints Breast Cancer Awareness PINK RIBBON New UNOPENED
Paypal   US $.01
Tic Tac Freshmints Breath Mint 12 count Pack tictac
Tic Tac Freshmints Breath Mint 12 count Pack tictac
Paypal   US $13.49
Squirrel TIC TAC TOE
Squirrel TIC TAC TOE
Paypal   US $5.00
Tortoise Hare Tic Tac Toe Garden Figurines
Tortoise Hare Tic Tac Toe Garden Figurines
Paypal   US $22.99
Tic Tac Mints WINTERGREEN 24 BIG Paks TicTacs TicTac
Tic Tac Mints WINTERGREEN 24 BIG Paks TicTacs TicTac
Paypal   US $37.30
TIC TAC TOE GAME DECORATIVE DUCK HUNTERS FREE SHIPPING
TIC TAC TOE GAME DECORATIVE DUCK HUNTERS FREE SHIPPING
Paypal   US $15.00
TIC TAC TOE GAME DECORATIVE BIRDS and BIRD HOUSES GARDEN FREE SHIPPING
TIC TAC TOE GAME DECORATIVE BIRDS and BIRD HOUSES GARDEN FREE SHIPPING
Paypal   US $10.00
24 BIG PACK FRESHMINT TICTAC MINTS TIC TACS PEPPERMINT
24 BIG PACK FRESHMINT TICTAC MINTS TIC TACS PEPPERMINT
Paypal   US $28.95
3800 ULTIMATE WOODWORKING PLANS COLLECTION on DVD
3800 ULTIMATE WOODWORKING PLANS COLLECTION on DVD
Paypal   US $6.95
Personalized TEAM UMIZOOMI Lollipop Sticker Tag Labels
Personalized TEAM UMIZOOMI Lollipop Sticker Tag Labels
Paypal   US $2.00
AMERICAN MINT ASSORTMENT TIC TAC MINTS 21 Packs 7 Flavors 3 Each
AMERICAN MINT ASSORTMENT TIC TAC MINTS 21 Packs 7 Flavors 3 Each
Paypal   US $34.30
Baby Snoopy Cute Baby Shower Invitations
Baby Snoopy Cute Baby Shower Invitations
Paypal   US $7.50
Beatrix Potter Peter Rabbit Shower Invitations
Beatrix Potter Peter Rabbit Shower Invitations
Paypal   US $7.50
Bachelorette Party Fun Scavenger Hunt Activity Game Cards Persoanlized
Bachelorette Party Fun Scavenger Hunt Activity Game Cards Persoanlized
Paypal   US $5.99
Tic Tac Mints 12 Pack Many Flavors to Choose From BIG PACK size Mix and Match
Tic Tac Mints 12 Pack Many Flavors to Choose From BIG PACK size Mix and Match
Paypal   US $12.99
Personalized HELLO KITTY Lollipop Sticker Tag Labels
Personalized HELLO KITTY Lollipop Sticker Tag Labels
Paypal   US $2.00
Personalized Wedding Bridal Shower Nugget Candy Bar Wrappers Favors
Personalized Wedding Bridal Shower Nugget Candy Bar Wrappers Favors
Paypal   US $4.49
10 Coupons Save $1 3 Single Tic Tac Mints
10 Coupons Save $1 3 Single Tic Tac Mints
Paypal   US $2.01
14 Cap Diploma Graduation Tic Tac Labels Several Colors
14 Cap Diploma Graduation Tic Tac Labels Several Colors
Paypal   US $2.00
Birthday 1st Birthday MINNIE MOUSE WATER BOTTLE LABELS
Birthday 1st Birthday MINNIE MOUSE WATER BOTTLE LABELS
Paypal   US $12.99
Birthday Super Mario Brothers WATER BOTTLE LABELS
Birthday Super Mario Brothers WATER BOTTLE LABELS
Paypal   US $22.99
54x108 Superhero Party Activity Fun Paper Table Cover
54x108 Superhero Party Activity Fun Paper Table Cover
Paypal   US $7.10
Graduation Graduate Full Size Candy Bar Wrappers Personalized Party Favors
Graduation Graduate Full Size Candy Bar Wrappers Personalized Party Favors
Paypal   US $7.99
Baby Shower Water Bottle Wrappers Party Favors Keepsake Personalized
Baby Shower Water Bottle Wrappers Party Favors Keepsake Personalized
Paypal   US $7.99
Tic Tac Orange Flavor 12 Big Packs 1oz American Mini Mints Candy
Tic Tac Orange Flavor 12 Big Packs 1oz American Mini Mints Candy
Paypal   US $19.15
Baptism Christening Envelope Seals Labels Stickers Personalized
Baptism Christening Envelope Seals Labels Stickers Personalized
Paypal   US $5.75
108 Baby Shower Kiss Candy Wrappers Labels Party Favors Personalized
108 Baby Shower Kiss Candy Wrappers Labels Party Favors Personalized
Paypal   US $5.75
Personalized Birthday Tic Tac Candy Wrappers Party Favors
Personalized Birthday Tic Tac Candy Wrappers Party Favors
Paypal   US $4.49
Twins Triplets Baby Shower Kiss Candy Wrappers Party Favors Personalized
Twins Triplets Baby Shower Kiss Candy Wrappers Party Favors Personalized
Paypal   US $11.25
Tic Tac Freshmint Flavor 12 Big Packs 1oz American Mini Mints Candy
Tic Tac Freshmint Flavor 12 Big Packs 1oz American Mini Mints Candy
Paypal   US $19.15
Tic Tac Green Apple Flavor 12 Big Packs 1oz American Mini Mints Candy
Tic Tac Green Apple Flavor 12 Big Packs 1oz American Mini Mints Candy
Paypal   US $19.15
Large Care Bear Unstuffed Pillows ALL FOUR
Large Care Bear Unstuffed Pillows ALL FOUR
Paypal   US $15.00
Tic Tac Toe Drinking Game Perfect party game
Tic Tac Toe Drinking Game Perfect party game
Paypal   US $7.99
Bachelorette Party Tic Tac Party Favor Labels Cute
Bachelorette Party Tic Tac Party Favor Labels Cute
Paypal   US $2.70
Personalized DORA Birthday Lollipop Sticker Tag Labels
Personalized DORA Birthday Lollipop Sticker Tag Labels
Paypal   US $2.00

Simple Tic-tac-toe Game Logic

n this article I will discuss about a very simple game. Yes, it is a Tic-Tak-Toe game of 3X3 dimension. It is a very simple game and I believe each and every one knows the rules of this game. So I am not going to mention anything about the game rules here. This article also gives you an idea about AI (Artificial Inelegancy) used in computer game. It is like giving thinking ability to you PC.

In this game you can play against computer. That is man vs. computer. The game is developed in VB6.0 and coded in very easy way to make the algorithm easy to understand. There are comments for each chunk of code which acts like a particular AI or games rule. I hope anyone can understand what I am going to do seeing the codes and comments. I used some Matrix formula to calculate/ find next move after a Human move.

Here is the complete listing of source code.

Private Sub Command1_Click(Index As Integer)
If Command1(Index).Caption = "" Then
Command1(Index).Caption = "X"
Call computer
Call win
Else
Beep
End If
End Sub
Public Sub computer()
Dim i, numb1, numb0, cou1, cou2 As Integer
'************CALCULATE THE NUMBER OF "X"************
For i = 0 To 8
If Command1(i).Caption = "X" Then
numb1 = numb1 + 1
End If
Next i
'*****************WIN OPPERTUNITY************
If (Command1(0).Caption = "O" And Command1(1).Caption = "O" And Command1(2).Caption = "") Then
Command1(2).Caption = "O"
Exit Sub
End If

If (Command1(0).Caption = "O" And Command1(2).Caption = "O" And Command1(1).Caption = "") Then
Command1(1).Caption = "O"
Exit Sub
End If

If (Command1(0).Caption = "O" And Command1(3).Caption = "O" And Command1(6).Caption = "") Then
Command1(6).Caption = "O"
Exit Sub
End If

If (Command1(0).Caption = "O" And Command1(6).Caption = "O" And Command1(3).Caption = "") Then
Command1(3).Caption = "O"
Exit Sub
End If
'****************************************
If (Command1(8).Caption = "O" And Command1(5).Caption = "O" And Command1(2).Caption = "") Then
Command1(2).Caption = "O"
Exit Sub
End If

If (Command1(8).Caption = "O" And Command1(2).Caption = "O" And Command1(5).Caption = "") Then
Command1(5).Caption = "O"
Exit Sub
End If

If (Command1(8).Caption = "O" And Command1(7).Caption = "O" And Command1(6).Caption = "") Then
Command1(6).Caption = "O"
Exit Sub
End If

If (Command1(8).Caption = "O" And Command1(6).Caption = "O" And Command1(7).Caption = "") Then
Command1(7).Caption = "O"
Exit Sub
End If
'********************************
If (Command1(6).Caption = "O" And Command1(7).Caption = "O" And Command1(8).Caption = "") Then
Command1(8).Caption = "O"
Exit Sub
End If

If (Command1(6).Caption = "O" And Command1(3).Caption = "O" And Command1(0).Caption = "") Then
Command1(0).Caption = "O"
Exit Sub
End If
'*****************************************
If (Command1(2).Caption = "O" And Command1(1).Caption = "O" And Command1(0).Caption = "") Then
Command1(0).Caption = "O"
Exit Sub
End If

If (Command1(2).Caption = "O" And Command1(5).Caption = "O" And Command1(8).Caption = "") Then
Command1(8).Caption = "O"
Exit Sub
End If

'***************LOGICS IF THE CENTER BOX CONTAIN "O"***********
If Command1(4).Caption = "O" Then
'*********************CROSS(X) LOGICS*****************
For q = 0 To 8 Step 2
If q = 4 Then
GoTo 2
End If
If Command1(q).Caption = "O" Then
n = 4 * 2 - q
If Command1(n).Caption = "" Then
Command1(n).Caption = "O"
Exit Sub
End If
End If
2 Next q
'*********************PLUSE(+) LOGICS*****************
For w = 1 To 7 Step 2
If w = 4 Then
GoTo 4
End If
If Command1(w).Caption = "O" Then
n = 4 * 2 - w
If Command1(n).Caption = "" Then
Command1(n).Caption = "O"
Exit Sub
End If
End If
4 Next w
End If

'************************PROCTECT GAME***********************
If (Command1(0).Caption = "X" And Command1(1).Caption = "X" And Command1(2).Caption = "") Then
Command1(2).Caption = "O"
Exit Sub
End If

If (Command1(0).Caption = "X" And Command1(2).Caption = "X" And Command1(1).Caption = "") Then
Command1(1).Caption = "O"
Exit Sub
End If

If (Command1(0).Caption = "X" And Command1(3).Caption = "X" And Command1(6).Caption = "") Then
Command1(6).Caption = "O"
Exit Sub
End If

If (Command1(0).Caption = "X" And Command1(6).Caption = "X" And Command1(3).Caption = "") Then
Command1(3).Caption = "O"
Exit Sub
End If
'****************************************
If (Command1(8).Caption = "X" And Command1(5).Caption = "X" And Command1(2).Caption = "") Then
Command1(2).Caption = "O"
Exit Sub
End If

If (Command1(8).Caption = "X" And Command1(2).Caption = "X" And Command1(5).Caption = "") Then
Command1(5).Caption = "O"
Exit Sub
End If

If (Command1(8).Caption = "X" And Command1(7).Caption = "X" And Command1(6).Caption = "") Then
Command1(6).Caption = "O"
Exit Sub
End If

If (Command1(8).Caption = "X" And Command1(6).Caption = "X" And Command1(7).Caption = "") Then
Command1(7).Caption = "O"
Exit Sub
End If

If (Command1(1).Caption = "X" And Command1(2).Caption = "X" And Command1(0).Caption = "") Then
Command1(0).Caption = "O"
Exit Sub
End If

If (Command1(6).Caption = "X" And Command1(7).Caption = "X" And Command1(8).Caption = "") Then
Command1(8).Caption = "O"
Exit Sub
End If
If (Command1(2).Caption = "X" And Command1(5).Caption = "X" And Command1(8).Caption = "") Then
Command1(8).Caption = "O"
Exit Sub
End If

If (Command1(3).Caption = "X" And Command1(6).Caption = "X" And Command1(0).Caption = "") Then
Command1(0).Caption = "O"
Exit Sub
End If

'**************PUT "O" IN CENTER BOX IF BLANK****************
If (numb1 = 1 And Command1(4).Caption = "") Then
Command1(4).Caption = "O"
Exit Sub
End If
'***************LOGICS IF THE CENTER BOX CONTAIN "X"***********
If Command1(4).Caption = "X" Then

'*********************CROSS(X) LOGICS*****************
For q = 0 To 8 Step 2
If q = 4 Then
GoTo 5
End If
If Command1(q).Caption = "X" Then
n = 4 * 2 - q
If Command1(n).Caption = "" Then
Command1(n).Caption = "O"
Exit Sub
End If
End If
5 Next q
'*********************PLUSE(+) LOGICS*****************
For q = 1 To 7 Step 2
If q = 4 Then
GoTo 6
End If
If Command1(q).Caption = "X" Then
n = 4 * 2 - q
If Command1(n).Caption = "" Then
Command1(n).Caption = "O"
Exit Sub
End If
End If
6 Next q

If Command1(0).Caption = "" Then
Command1(0).Caption = "O"
Exit Sub
End If

If Command1(2).Caption = "" Then
Command1(2).Caption = "O"
Exit Sub
End If

If Command1(6).Caption = "" Then
Command1(6).Caption = "O"
Exit Sub
End If

If Command1(8).Caption = "" Then
Command1(8).Caption = "O"
Exit Sub
End If
End If

'*******************MASTER LOGICS(1)*********
If (Command1(3).Caption = "X" And Command1(1).Caption = "X") Then
If Command1(0).Caption = "" Then
Command1(0).Caption = "O"
Exit Sub
End If
End If

If (Command1(1).Caption = "X" And Command1(5).Caption = "X") Then
If Command1(2).Caption = "" Then
Command1(2).Caption = "O"
Exit Sub
End If
End If

If (Command1(5).Caption = "X" And Command1(7).Caption = "X") Then
If Command1(8).Caption = "" Then
Command1(8).Caption = "O"
Exit Sub
End If
End If

If (Command1(3).Caption = "X" And Command1(7).Caption = "X") Then
If Command1(6).Caption = "" Then
Command1(6).Caption = "O"
Exit Sub
End If
End If

'************************master logics(2)***************

If (Command1(3).Caption = "X") Then
If Command1(2).Caption = "X" And Command1(0).Caption = "" Then
Command1(0).Caption = "O"
Exit Sub
End If

If Command1(8).Caption = "X" And Command1(6).Caption = "" Then
Command1(6).Caption = "O"
Exit Sub
End If
End If

If (Command1(5).Caption = "X") Then
If Command1(0).Caption = "X" And Command1(2).Caption = "" Then
Command1(2).Caption = "O"
Exit Sub
End If

If Command1(6).Caption = "X" And Command1(8).Caption = "" Then
Command1(8).Caption = "O"
Exit Sub
End If
End If

If (Command1(7).Caption = "X") Then
If Command1(0).Caption = "X" And Command1(6).Caption = "" Then
Command1(6).Caption = "O"
Exit Sub
End If

If Command1(2).Caption = "X" And Command1(8).Caption = "" Then
Command1(8).Caption = "O"
Exit Sub
End If
End If

If (Command1(1).Caption = "X") Then
If Command1(6).Caption = "X" And Command1(0).Caption = "" Then
Command1(0).Caption = "O"
Exit Sub
End If
If Command1(8).Caption = "X" And Command1(2).Caption = "" Then
Command1(2).Caption = "O"
Exit Sub
End If

End If

'**********************************************
If (numb1 = 5) Then
MsgBox "*****Game over*****"
Call newer
GoTo 10
End If

'*************Master Logics(1)*****************
For K = 1 To 7 Step 2
If Command1(4).Caption = "O" And Command1(K).Caption = "" Then
Command1(K).Caption = "O"
Exit Sub
End If
Next K

8 cou1 = Int(Rnd * 9)
If Command1(cou1).Caption = "" Then
Command1(cou1).Caption = "O"
Else
GoTo 8
End If

10 End Sub

Private Sub exit_Click()
End
End Sub

Private Sub Form_Load()
Open "C:WIN.TXT" For Append As #1
Close #1
End Sub

Private Sub new_Click()
Call newer
End Sub
Public Sub win()
'**********************YOU WIN*************
If (Command1(1).Caption = "X" And Command1(0).Caption = "X" And Command1(2).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

If (Command1(0).Caption = "X" And Command1(4).Caption = "X" And Command1(8).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

If (Command1(0).Caption = "X" And Command1(3).Caption = "X" And Command1(6).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

If (Command1(1).Caption = "X" And Command1(4).Caption = "X" And Command1(7).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

If (Command1(2).Caption = "X" And Command1(5).Caption = "X" And Command1(8).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

If (Command1(3).Caption = "X" And Command1(4).Caption = "X" And Command1(5).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

If (Command1(6).Caption = "X" And Command1(7).Caption = "X" And Command1(8).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

If (Command1(6).Caption = "X" And Command1(4).Caption = "X" And Command1(2).Caption = "X") Then
MsgBox "***You win***"
Call newer
End If

'*****************YOU LOST*************
If (Command1(1).Caption = "O" And Command1(0).Caption = "O" And Command1(2).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
If (Command1(4).Caption = "O" And Command1(0).Caption = "O" And Command1(8).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
If (Command1(3).Caption = "O" And Command1(0).Caption = "O" And Command1(6).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
If (Command1(1).Caption = "O" And Command1(4).Caption = "O" And Command1(7).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
If (Command1(2).Caption = "O" And Command1(5).Caption = "O" And Command1(8).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
If (Command1(3).Caption = "O" And Command1(4).Caption = "O" And Command1(5).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
If (Command1(6).Caption = "O" And Command1(7).Caption = "O" And Command1(8).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
If (Command1(6).Caption = "O" And Command1(4).Caption = "O" And Command1(2).Caption = "O") Then
MsgBox "***You loset***"
Call newer
End If
End Sub

Public Sub newer()
For i = 0 To 8
Command1(i).Caption = ""
Next i
End Sub

Download the project from BD Experts site

 

 

 

About the Author

I am basically a Application/web developer. Microsoft technology is my working tool. I am interested with new advance technologies of programming and database. I am also running a website http://www.bd-experts.com which is mostly a article sharing website.

How do you play shot glass tic-tac-toe?

hi =)
i have a shot glass tic tac toe game. i know how to play regular tic tac toe, but not the shot glass one. how do you know when to take a shot?

I'm not exactly sure but maybe the loser takes a shot or maybe it'd make more sense for the winner to take a shot? I have no clue, sorry! I tried!

Comments are closed.