Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 for i=1 to 40:print "":next i
- 2 DIM board$(9)
- 10 print "TIC TAC TOE"
- 20 print "By MineRobber9000"
- 30 print "For AppleSoft BASIC"
- 40 print "-------------------"
- 44 gosub 1400
- 45 goto 90:REM 1 player mode will come later, but for now I can make 2p
- 50 print "Mode? (1 = 2 players, 2 = 1 player)"
- 60 input a
- 70 on a goto 90
- 80 print "Invalid mode, try again":goto 50
- 90 turn = 0
- 100 if turn==1 goto 150
- 110 print "Player 1, your move"
- 120 gosub 1100
- 121 gosub 1200
- 130 turn = 1
- 140 goto 100
- 150 print "Player 2, your move"
- 160 gosub 1100
- 161 gosub 1200
- 170 turn = 0
- 180 goto 100
- 1000 end
- 1100 start = 1
- 1110 gosub 1170
- 1120 gosub 1180
- 1130 start = 4:gosub 1170
- 1140 gosub 1180
- 1150 start = 7:gosub 1170
- 1160 return
- 1170 print board$(start);"|";board$(start+1);"|";board$(start+2):return
- 1180 print "-+-+-":return
- 1200 input "Space?(1-9):";a
- 1210 if board$(a)==" " goto 1220
- 1215 print "Invalid move, try again":goto 1200
- 1220 if turn==0 then let board$(a)="X"
- 1230 if turn==1 then let board$(a)="O"
- 1240 if board$(1)==" " goto 1250:if board$(1)==board$(2) then if board$(2)==board$(3) then goto 1300
- 1250 if board$(4)==" " goto 1260:if board$(4)==board$(5) then if board$(5)==board$(6) then goto 1300
- 1260 if board$(7)==" " goto 1270:if board$(7)==board$(8) then if board$(8)==board$(9) then goto 1300
- 1270 if board$(1)==" " goto 1280:if board$(1)==board$(4) then if board$(4)==board$(7) then goto 1300
- 1280 if board$(2)==" " goto 1290:if board$(2)==board$(5) then if board$(5)==board$(8) then goto 1300
- 1290 if board$(3)==" " goto 1292:if board$(3)==board$(6) then if board$(6)==board$(9) then goto 1300
- 1292 if board$(1)==" " goto 1294:if board$(1)==board$(5) then if board$(5)==board$(9) then goto 1300
- 1294 if board$(7)==" " goto 1295:if board$(7)==board$(5) then if board$(5)==board$(3) then goto 1300
- 1295 return
- 1300 if board$(a)=="X" then print "Player 1 wins!"
- 1310 if board$(a)=="O" then print "Player 2 wins!"
- 1320 call 54915
- 1325 gosub 1400
- 1330 goto 45:REM restart game, TODO: add choice
- 1400 for i=1 to 9:let board$(i)=" ":next i:return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement