8-Bit Software Online Conversion
OXO - Listing
20DIM square%(2,2)
30:
40REPEAT
50 MODE 7
60 PROClogo
70 PRINT " This is the game of nough
ts and"
80 PRINT " crosses, but played with
squares"
90 PRINT " instead of noughts - squa
res are"
100 PRINT " quicker and easier to dra
w!"
110 PRINT
120 PRINT " I expect everyone knows t
he rules."
130 PRINT " KEYS"
140 PRINT
150 PRINT " Z - left X - Right"
160 PRINT " K - Up M - Down"
170 PRINT " L - Place nought/cross"
180 PRINT
190 PRINT " Press a key to start"
200 :
210 REPEAT:UNTIL GET
220 :
230 REPEAT
240 PROClogo
250 PRINT " How many rounds do you
want to play"
260 PRINT " (must be an odd number)
"
270 INPUT " "rounds%
280 a=rounds% MOD 2
290 UNTIL a<>0
300 :
310 game%=0
320 plya%=0
330 plyb%=0
340 REPEAT
350 square%(0,0)=0
360 square%(0,1)=0
370 square%(0,2)=0
380 square%(1,0)=0
390 square%(1,1)=0
400 square%(1,2)=0
410 square%(2,0)=0
420 square%(2,1)=0
430 square%(2,2)=0
440 game%=game%+1
450 MODE 1
460 PROCdrawboard
500 player%=1
510 PROCsetitup
520 win=FALSE
530 draw=FALSE
540 manx%=1
550 many%=1
560 PROCflash(manx%,many%)
570 :
580 REPEAT
590 IF player%=1 THEN PRINTTAB(0,2)
"Player 1s turn. (player 1 is o)" ELSE P
RINTTAB(0,2) "Player 2s turn. (player 2
is x)"
600 key$=GET$
610 PROCclear(manx%,many%)
620 IF key$="L" OR key$="l" THEN
PROCfire
630 IF key$="Z" OR key$="z" THEN
manx%=manx%-1 : IF manx%<0 THEN manx%=0
640 IF key$="X" OR key$="x" THEN
manx%=manx%+1 : IF manx%>2 THEN manx%=2
650 IF key$="K" OR key$="k" THEN
many%=many%+1 : IF many%>2 THEN many%=2
660 IF key$="M" OR key$="m" THEN
many%=many%-1 : IF many%<0 THEN many%=0
670 :
680 PROCflash(manx%,many%)
690 UNTIL (win=TRUE OR draw=TRUE)
700 PROCsetitup
710 PROCframe
720 COLOUR 2
730 IF win=TRUE THEN PROCwin
740 IF draw=TRUE THEN PROCdraw
750
760 UNTIL game%=rounds%
770 :
780 quit=FALSE
790 IF plya%>plyb% THEN player%=1
800 IF plyb%>plya% THEN player%=2
810 PRINTTAB(3,13) "Player ";player%;
" has won this"
820 PRINTTAB(3,14) "tournament."
830 PRINTTAB(3,16) "Press 'Q' to quit
, or"
840 PRINTTAB(3,17) "any other key to
play"
850 PRINTTAB(3,18) "another tournamen
t."
860 key$=GET$
870 IF key$="q" OR key$="Q" THEN quit
=TRUE
880UNTIL quit=TRUE
890:
900END
910:
920DEFPROCwin
930 IF player%=1 THEN plya%=plya%+1
940 IF player%=2 THEN plyb%=plyb%+1
950 PRINTTAB(3,13) "Player ";player%;
" has won this"
960 PRINTTAB(3,14) "game."
970 PRINTTAB(3,16) "Press a key to"
980 PRINTTAB(3,17) "continue."
990 REPEAT : UNTIL GET
1000ENDPROC
1010:
1020DEFPROCdraw
1030 PRINTTAB(3,13) "No one won this g
ame."
1040 PRINTTAB(3,15) "Press any key to"
1050 PRINTTAB(3,16) "replay the game."
1070 REPEAT : UNTIL GET
1080 game%=game%-1
1090ENDPROC
1100:
1110DEFPROCframe
1120 GCOL 0,1
1130 MOVE 110,310
1140 MOVE 110,610
1150 PLOT 85,810,310
1160 MOVE 810,610
1170 PLOT 85,110,610
1180 :
1190 GCOL 0,3
1200 MOVE 110,310
1210 DRAW 110,610
1220 DRAW 810,610
1230 DRAW 810,310
1240 DRAW 110,310
1250 :
1260 GCOL 0,0
1270 MOVE 90,330
1280 MOVE 90,630
1290 PLOT 85,790,330
1300 MOVE 790,630
1310 PLOT 85,90,630
1320 :
1330 GCOL 0,3
1340 MOVE 90,330
1350 DRAW 90,630
1360 DRAW 790,630
1370 DRAW 790,330
1380 DRAW 90,330
1390ENDPROC
1400:
1410DEFPROCsetitup
1420 COLOUR 1
1430 PRINTTAB(0,0)"Noughts and Squares
- by Richard Harker"
1450 COLOUR 3
1460 PRINTTAB(30,4)"Games to"
1470 PRINTTAB(30,5)"play."
1480 PRINTTAB(30,6);rounds%
1490 PRINTTAB(30,8)"Games"
1500 PRINTTAB(30,9)"played."
1510 PRINTTAB(30,10);game%-1
1520 PRINTTAB(30,12)"Player 1"
1530 PRINTTAB(30,13)"has won"
1540 PRINTTAB(30,14);plya%" games"
1550 PRINTTAB(30,16)"Player 2"
1560 PRINTTAB(30,17)"has won"
1570 PRINTTAB(30,18);plyb%" games"
1580ENDPROC
1590:
1600DEFPROClogo
1610 CLS
1620 PRINT "
pppppppppppppp";
1630 PRINT "
"
1640 PRINT " Tinned Peach Sof
tware
1650 PRINT "
¶¶¶¶¶¶7";
1660 PRINT " 'We give you a
byte
1670 PRINT " of the action
!'
1680 PRINT "
pppppp
1690 PRINT "
j
1700 PRINT " Noughts and Squares
1710 PRINT " By Richard Harker - Jun 1
998 - For 8BS.";
1720 PRINT "
,,,,,,,,,,,,,,";
1730 PRINT
1740ENDPROC
1750:
1760DEFPROCfire
1770 IF square%(manx%,many%)<>0 THEN E
NDPROC
1780 IF player%=1 THEN PROCnought(manx
%,many%) : square%(manx%,many%)=1
1790 IF player%=2 THEN PROCcross(manx%
,many%) : square%(manx%,many%)=2
1800 :
1810 a%=0
1820 b%=0
1830 c%=0
1840 d%=0
1850 e%=0
1860 f%=0
1870 g%=0
1880 h%=0
1890 IF square%(0,2)=player% THEN c%=c
%+1 :b%=b%+1 :h%=h%+1
1900 IF square%(1,2)=player% THEN c%=c
%+1 :g%=g%+1
1910 IF square%(2,2)=player% THEN c%=c
%+1 :a%=a%+1 :f%=f%+1
1920 IF square%(0,1)=player% THEN d%=d
%+1 :h%=h%+1
1930 IF square%(1,1)=player% THEN d%=d
%+1 :a%=a%+1 :b%=b%+1 :g%=g%+1
1990 IF square%(2,1)=player% THEN d%=d
%+1 :f%=f%+1
2000 IF square%(0,0)=player% THEN e%=e
%+1 :a%=a%+1 :h%=h%+1
2010 IF square%(1,0)=player% THEN e%=e
%+1 :g%=g%+1
2020 IF square%(2,0)=player% THEN e%=e
%+1 :b%=b%+1 :f%=f%+1
2021 IF (a%=3 OR b%=3 OR c%=3 OR d%=3
OR e%=3 OR f%=3 OR g%=3 OR h%=3) THEN wi
n=TRUE :ENDPROC
2130 IF win=FALSE THEN IF player%=1 TH
EN player%=2 ELSE player%=1
2140 IF win=FALSE THEN PROCcheck`for`d
raw
2150ENDPROC
2160:
2170DEFPROCcheck`for`draw
2180 draw=TRUE
2190 FOR tempx%=0 TO 2
2200 FOR tempy%=0 TO 2
2210 IF square%(tempx%,tempy%)=0 T
HEN draw=FALSE
2220 NEXT
2230 NEXT
2240ENDPROC
2250:
2260DEFPROCflash(manx%,many%)
2270 GCOL 0,2
2280 MOVE manx%*300+8,many%*300+8
2290 DRAW manx%*300+300-8,many%*300+8
2300 DRAW manx%*300+300-8,many%*300+30
0-8
2310 DRAW manx%*300+8,many%*300+300-8
2320 DRAW manx%*300+8,many%*300+8
2330ENDPROC
2340:
2350DEFPROCclear(manx%,many%)
2360 GCOL 0,0
2370 MOVE manx%*300+8,many%*300+8
2380 DRAW manx%*300+300-8,many%*300+8
2390 DRAW manx%*300+300-8,many%*300+30
0-8
2400 DRAW manx%*300+8,many%*300+300-8
2410 DRAW manx%*300+8,many%*300+8
2420ENDPROC
2430:
2440DEFPROCdrawboard
2450 GCOL 0,1
2460 MOVE 950,0
2470 MOVE 950,880
2480 PLOT 85,1260,880
2490 MOVE 1260,0
2500 PLOT 85,950,0
2510 :
2520 GCOL 0,3
2530 MOVE 950,0
2540 DRAW 950,880
2550 DRAW 1260,880
2560 DRAW 1260,0
2570 DRAW 950,0
2580 :
2590 GCOL 0,0
2600 MOVE 930,20
2610 MOVE 930,900
2620 PLOT 85,1240,900
2630 MOVE 1240,20
2640 PLOT 85,930,20
2650 :
2660 GCOL 0,3
2670 MOVE 930,20
2680 DRAW 930,900
2690 DRAW 1240,900
2700 DRAW 1240,20
2710 DRAW 930,20
2720 :
2730 MOVE 0,0
2740 DRAW 0,900
2750 DRAW 900,900
2760 DRAW 900,0
2770 DRAW 0,0
2780 MOVE 0,300
2790 DRAW 900,300
2800 MOVE 0,600
2810 DRAW 900,600
2820 MOVE 300,0
2830 DRAW 300,900
2840 MOVE 600,0
2850 DRAW 600,900
2860ENDPROC
2870:
2880DEFPROCnought(x,y)
2890 GCOL 0,1
2900 MOVE (x*300)+20,(y*300)+280
2910 MOVE (x*300)+20,(y*300)+20
2920 PLOT 85,(x*300)+280,(y*300)+20
2930 MOVE (x*300)+280,(y*300)+280
2940 PLOT 85,(x*300)+20,(y*300)+280
2950 GCOL 0,0
2960 MOVE (x*300)+40,(y*300)+260
2970 MOVE (x*300)+40,(y*300)+40
2980 PLOT 85,(x*300)+260,(y*300)+40
2990 MOVE (x*300)+260,(y*300)+260
3000 PLOT 85,(x*300)+40,(y*300)+260
3010ENDPROC
3020:
3030DEFPROCcross(x,y)
3040 GCOL 0,1
3050 MOVE (x*300)+40,(y*300)+20
3060 MOVE (x*300)+20,(y*300)+40
3070 PLOT 85,(x*300)+260,(y*300)+280
3080 MOVE (x*300)+280,(y*300)+260
3090 PLOT 85,(x*300)+40,(y*300)+20
3100 :
3110 MOVE (x*300)+280,(y*300)+40
3120 MOVE (x*300)+260,(y*300)+20
3130 PLOT 85,(x*300)+20,(y*300)+260
3140 MOVE (x*300)+40,(y*300)+280
3150 PLOT 85,(x*300)+280,(y*300)+40
3160ENDPROC