Skip to main content

TIC TAC TOE game using Q BASIC

10 PRINT TAB(30);"TIC TAC TOE"
20 PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
30 PRINT:PRINT:PRINT
50 REM
100 REM   THIS PROGRAM PLAYS TIC TAC TOE
110 REM   THE MACHINE GOES FIRST
120 PRINT "THE GAME BOARD IS NUMBERED:": PRINT
130 PRINT "1  2  3": PRINT "8  9  4": PRINT "7  6  5"
140 PRINT
150 REM
160 REM
170 REM
180 DEF FNM(X)=X-8*INT((X-1)/8)
190 REM
200 REM  MAIN PROGRAM
210 PRINT
220 PRINT
230 A=9
240 M=A
250 GOSUB 650
260 P=M
270 B=FNM(P+1)
280 M=B
290 GOSUB 650
300 Q=M
310 IF Q=FNM(B+4) THEN 360
320 C=FNM(B+4)
330 M=C
340 GOSUB 700
350 GOTO 730
360 C=FNM(B+2)
370 M=C
380 GOSUB 650
390 R=M
400 IF R=FNM(C+4) THEN 450
410 D=FNM(C+4)
420 M=D
430 GOSUB 700
440 GOTO 730
450 IF P/2<>INT(P/2) THEN 500
460 D=FNM(C+7)
470 M=D
480 GOSUB 700
490 GOTO 730
500 D=FNM(C+3)
510 M=D
520 GOSUB 650
530 S=M
540 IF S=FNM(D+4) THEN 590
550 E=FNM(D+4)
560 M=E
570 GOSUB 700
580 REM
590 E=FNM(D+6)
600 M=E
610 GOSUB 700
620 PRINT "THE GAME IS A DRAW."
630 GOTO 210
640 REM
650 GOSUB 700
660 PRINT "YOUR MOVE";
670 INPUT M
680 RETURN
700 PRINT "COMPUTER MOVES";M
710 RETURN
720 REM
730 PRINT "AND WINS ********"
740 GOTO 210
750 END

Comments

  1. Game for the students under secondary...using Bacis q basic.....

    ReplyDelete

Post a Comment

Popular posts from this blog

Class x_ Blue j java question solve(Important)

Section – A Answer any four of the following : 1 . Write a Program to calculate charges for sending particles when the charges are as follows For the first 1KG  Rs.15.00  , For additional weight , for every 500gm or fraction thereof: Rs 8.00 Ans class Prog1 { static void test(double wt)//user enters the weight in KGs { System.out.println(“Parcel  Weight is “+wt); int icharge = 15; System.out.println(“Initial  charge is “+icharge); int rwt = (int)((wt-1)*1000); System.out.println(“Remaining  weight after deducing 1Kg “+rwt); int rcharge = (rwt/500)*8; System.out.println(“Charge  excluding fractional part is Rs.”+(icharge+rcharge)); int fcharge = (rwt%500>0)?8:0; System.out.println(“Charge  for fractional part is Rs. “+fcharge); int tcharge = icharge+rcharge+fcharge; System.out.println(“Total  Charge is Rs. “+tcharge); } } 2 . A special two-digit number is such that when the sum of its digits is added to the product of its digits , the res...