|
|
Tic-Tac-Toe
Size: 906 Bytes
___________________________________________________________
Command translation:
-> Single arrow (located on the keyboard)
=> Double arrow (press: [Shift] [prgm] [f1] [f1])
_ Display, -Disp- (press: [shift] [prgm] [f4])
<= Less or equal (A <= B)
>= Greater or equal (A >= B)
<> Not equal (A <> B)
^ Raised to the power of
/ Division or fraction (explain which with a comment)
2rt() Root (2rt(7) is the square root of 7)
4rt() 4th root
pi pi (~3.14159265359, low case)
e() e(1) (~2.7818281846 low case)
E Exponent (5E4 gives 5*10^4) (located on the keyboard,
[EXP])
____________________________________________________________
Everything after a ; is a comment and should not be in the code.
____________________________________________________________
Program:
'TIC-TAC-TOE'
Range 0,9.4,100,-0.8,5.4,100
0->A~Z
1->B
5.4->Q ;Just to save some memory...
9.4->R
7.4->P
Cls
Graph Y=5.4 ;Graphs the game area...
Plot R,0
Plot R,Q
Line
Plot 0,0
Plot 2,Q
Line
Plot 0,Q
Plot 2,0
Line
Plot P,0
Plot R,Q
Line
Plot R,0
Plot P,Q
Line
Lbl 4
Plot A+2,0 ;Graphs the grid
Plot A+2,Q
Line
Plot P,A
Plot 2,A
Line
A>=5.4=>Goto 1 ;Larger than or equal
A+1.8->A
Goto 4
Lbl 1
Z=9=>Goto 7
Plot _ ;Disp!!
X<=2=>Goto 9
X>=2.1=>X<=3.7=>0->S ;Sets where the marker should be put
X=3.8=>Goto 9
X>=3.9=>X<=5.5=>1->S
X=5.6=>Goto 9
X>=5.7=>X<=7.3=>2->S
X>=7.4=>Goto 9
Y<=0=>Goto 9
Y>=0.1=>X<=1.7=>0->T
Y=1.8=>Goto 9
Y>=1.9=>X<=3.5=>1->T
Y=3.6=>Goto 9
Y>=3.7=>X<=5.3=>2->T
Y=5.4=>Goto 9
S=0=>T=0=>G=1=>Goto 8 ;Checks so you cant place a marker over
S=0=>T=0=>1->G ;another. Can be removed to save memory.
S=1=>T=0=>H=1=>Goto 8
S=1=>T=0=>1->H
S=2=>T=0=>I=1=>Goto 8
S=2=>T=0=>1->I
S=0=>T=1=>J=1=>Goto 8
S=0=>T=1=>1->J
S=1=>T=1=>K=1=>Goto 8
S=1=>T=1=>1->K
S=2=>T=1=>L=1=>Goto 8
S=2=>T=1=>1->L
S=0=>T=2=>M=1=>Goto 8
S=0=>T=2=>1->M
S=1=>T=2=>N=1=>Goto 8
S=1=>T=2=>1->N
S=2=>T=2=>O=1=>Goto 8
S=2=>T=2=>1->O
Isz Z
B=2=>Goto 3
Plot (S*1.8)+2,T*1.8
Plot (S*1.8)+3.8,(T*1.8)+1.8
Line
Plot (S*1.8)+2,(T*1.8)+1.8
Plot (S*1.8)+3.8,T*1.8
Line
2->B
Goto 1
Lbl 3
Plot (S*1.8)+2.3,(T*1.8)+0.3
Plot (S*1.8)+3.5,(T*1.8)+0.3
Line
Plot (S*1.8)+3.5,(T*1.8)+1.5
Line
Plot (S*1.8)+2.3,(T*1.8)+1.5
Line
Plot (S*1.8)+2.3,(T*1.8)+0.3
Line
1->B
Goto 1
Lbl 9
"ERROR"_ ;Disp!
Goto 1
Lbl 8
"TAKEN!"_ ;Disp!
Goto 1
Lbl 7
" "
" THE END"
|