Tic-Tac-Toe



tictact2
--------

This version is for two players.

To play, simply use numbers 1-9 to place your X or O. The numbers make a
similar grid as to the playing field.....

7       8       9
4       5       6
1       2       3

Mode will pause the game, and clear quits. If you want to get rid of the
little opening thing I made, simply delete the code from the line that
starts.....

Horizontal 3.1
                to.....
Pause

Right after the pause is the following two lines (don't delete them)....
0->A
0->B

Well, enjoy the game. Send any questions or comments to
cakewalk@voicenet.com. I've changed email addresses, so if you're looking
for PopF12345@aol.com, that's me too. Please send mail to the voicenet
address (I have some other programs up here that you could have questions
about).

Code comments: When you cut and paste the code from the program to emails,
certain characters are undefined, so the email program uses ASCII values. I
had to change some things around.
So, when you see this...

->              it means STORE (right above on button)
Á               it means THETA (right next to Z key, hit alpha first)
ø               it means NOT EQUAL TO (under TEST)

That should be the only problems after I fixed the other things up. Well,
good luck.

Here's the code.....

ClrHome
Func:FnOff :AxesOff:ZDecimal
Horizontal 3.1
Horizontal -3.1
Vertical -4.7
Vertical 4.7
For(A,.5,1.5,.5)
Circle(0,-.5,A)
End
For(C,6,70,32)
8->A
For(B,C,C+16,3)
Text(A,B,"X"
A+5->A
End
8->A
For(B,C+15,C-1,-3)
Text(A,B,"X"
A+5->A
End
If C=6
Text(1,9,"TIC"
If C=38
Text(1,41,"TAC"
If C=70
Text(1,73,"TOE"
End
Text(46,8,"BY:"
Text(53,4,"JEFF FREEMAN"
Text(46,65,"PRESS"
Text(53,64,"-ENTER-"

Pause
0->A
0->B
Lbl 1
ClrDraw
0->S
2->O
"X"->Str1
DelVar [F]
{3,3}->dim([F])
Text(1,1,"PRESS 1-9 TO PLACE X OR O."
Text(8,1,"MODE PAUSES   :   CLEAR QUITS"
Line(-4.7,1.4,4.7,1.4)

Line(-1.8,1,-1.8,-3.1)
Line(-3.2,1,-3.2,-3.1)
Line(-4.6,-.3,-.4,-.3)
Line(-4.6,-1.7,-.4,-1.7)
Text(20,53,"X-SCORE: ",A
Text(28,53,"O-SCORE: ",B
Line(.6,.5,3.4,.5
Line(.6,-.3,3.4,-.3
For(C,1,9,1)
Text(57,53,Str1,"^S TURN"
getKey->Á
0->Á
While Áø72 and Áø73 and Áø74 and Áø82 and Áø83 and Áø84 and Áø92 and Áø93
and Áø94
getKey->Á
If Á=22
Pause
If Á=45
Goto QT
If (Á>72 and Á<74) or (Á>82 and Á<84) or (Á>92 and Á<94):Then
If Á=72:Then
1->G:1->H:End
If Á=73:Then
1->G:2->H:End
If Á=74:Then
1->G:3->H:End
If Á=82:Then
2->G:1->H:End
If Á=83:Then
2->G:2->H:End
If Á=84:Then
2->G:3->H:End
If Á=92:Then
3->G:1->H:End
If Á=93:Then
3->G:2->H:End
If Á=94:Then
3->G:3->H:End
[F](G,H)->K
If K=0
O->[F](G,H)
If Kø0
0->Á
End
End
If Á-74<0
.5->Y
If Á-74>0 and Á-74<10
-1->Y
If Á-74>10
-2.4->Y
If Á=72 or Á=82 or Á=92
-4->X
If Á=73 or Á=83 or Á=93
-2.5->X
If Á=74 or Á=84 or Á=94
-1->X

If O=5
Circle(X,Y,.4
If O=2:Then
Line(X-.4,Y+.4,X+.4,Y-.4
Line(X+.4,Y+.4,X-.4,Y-.4
End
If O=5:Then
2->O:"X"->Str1
Else
5->O:"O"->Str1
End

If C>5:Then
For(Q,1,3,1)
[F](Q,1)*[F](Q,2)*[F](Q,3)->S
If S=8
Goto XW
If S=125
Goto OW
End
For(Q,1,3,1)
[F](1,Q)*[F](2,Q)*[F](3,Q)->S
If S=8
Goto XW
If S=125
Goto OW
End
[F](1,1)*[F](2,2)*[F](3,3)->S
If S=8
Goto XW
If S=125
Goto OW
[F](1,3)*[F](2,2)*[F](3,1)->S
If S=8
Goto XW
If S=125
Goto OW
End
End

Text(35,53,"DRAW"
Goto E

Lbl XW
A+1->A
Text(35,53,"X WINS"
Goto E
Lbl OW
B+1->B
Text(35,53,"O WINS"

Lbl E
Text(43,53,"-PRESS-"
Text(50,53,"-ENTER-"
Pause
Menu("ANOTHER ROUND?","YES",1,"NO",QT

Lbl QT
ClrDraw
ZStandard
AxesOn
ClrHome

© 1997 bckcoats@ix.netcom.com


This page hosted by GeoCities Get your own Free Home Page


1