tic tac toe by cactuar man30th Aug 2007 0:04
|
---|
Summary a fun little game of tic tac toe Description this was one of my first games I made and it is pretty fun. I like it and I hope you enjoy it also. ^_^ Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com a=280 b=245 c=290 d=255 print "imagine the board like a calculator 7 being top left and 3 being bottom right" suspend for key cls wrongs: wrongc: cls print "select the color of the playing field" print "1 red" print "2 green" print "3 blue" input color# if color#>3 then goto wrongc if color#<1 then goto wrongc if color#=1 then gosub red if color#=2 then gosub green if color#=3 then gosub blue print "what is the name of player 1" input pl1name$ cls print "what is the nome of player 2" input pl2name$ rem gamestart @##$$%$##E@#!^$#@#%$^$#$@# ink rgb(re#,gr#,bl#),rgb(0,0,0) gamestart: rem player 1 turn do cls print pl1name$ print "where would you like to go" p1turn: move#=0 rem field line 270,210,360,210 line 270,240,360,240 line 300,180,300,260 line 330,180,330,260 rem field gosub 1show input move# if move#=1 and onespace#<>0 then goto p1turnmis if move#=2 and twospace#<>0 then goto p1turnmis if move#=3 and threespace#<>0 then goto p1turnmis if move#=4 and fourspace#<>0 then goto p1turnmis if move#=5 and fivespace#<>0 then goto p1turnmis if move#=6 and sixspace#<>0 then goto p1turnmis if move#=7 and sevenspace#<>0 then goto p1turnmis if move#=8 and eightspace#<>0 then goto p1turnmis if move#=9 and ninespace#<>0 then goto p1turnmis if move#<1 and move#>9 then goto p1turnmis if move#=1 and onespace#=0 then onespace#=1 if move#=2 and twospace#=0 then twospace#=1 if move#=3 and threespace#=0 then threespace#=1 if move#=4 and fourspace#=0 then fourspace#=1 if move#=5 and fivespace#=0 then fivespace#=1 if move#=6 and sixspace#=0 then sixspace#=1 if move#=7 and sevenspace#=0 then sevenspace#=1 if move#=8 and eightspace#=0 then eightspace#=1 if move#=9 and ninespace#=0 then ninespace#=1 gosub check rem player 2 turn cls print pl2name$ print "where would you like to go" p2turn: move#=0 rem field line 270,210,360,210 line 270,240,360,240 line 300,180,300,260 line 330,180,330,260 rem field gosub 1show input move# if move#=1 and onespace#<>0 then goto p2turnmis if move#=2 and twospace#<>0 then goto p2turnmis if move#=3 and threespace#<>0 then goto p2turnmis if move#=4 and fourspace#<>0 then goto p2turnmis if move#=5 and fivespace#<>0 then goto p2turnmis if move#=6 and sixspace#<>0 then goto p2turnmis if move#=7 and sevenspace#<>0 then goto p2turnmis if move#=8 and eightspace#<>0 then goto p2turnmis if move#=9 and ninespace#<>0 then goto p2turnmis if move#<1 and move#>9 then goto p1turnmis if move#=1 and onespace#=0 then onespace#=-1 if move#=2 and twospace#=0 then twospace#=-1 if move#=3 and threespace#=0 then threespace#=-1 if move#=4 and fourspace#=0 then fourspace#=-1 if move#=5 and fivespace#=0 then fivespace#=-1 if move#=6 and sixspace#=0 then sixspace#=-1 if move#=7 and sevenspace#=0 then sevenspace#=-1 if move#=8 and eightspace#=0 then eightspace#=-1 if move#=9 and ninespace#=0 then ninespace#=-1 gosub check loop p1turnmis: print "your answer was not acceptable" goto p1turn p2turnmis: print "your answer was not acceptable" goto p2turn 1show: if onespace#=1 then circle 285,250,10 if twospace#=1 then circle 315,250,10 if threespace#=1 then circle 345,250,10 if fourspace#=1 then circle 285,225,10 if fivespace#=1 then circle 315,225,10 if sixspace#=1 then circle 345,225,10 if sevenspace#=1 then circle 285,195,10 if eightspace#=1 then circle 315,195,10 if ninespace#=1 then circle 345,195,10 if onespace#=-1 then gosub X1 if twospace#=-1 then gosub X2 if threespace#=-1 then gosub X3 if fourspace#=-1 then gosub X4 if fivespace#=-1 then gosub X5 if sixspace#=-1 then gosub X6 if sevenspace#=-1 then gosub X7 if eightspace#=-1 then gosub X8 if ninespace#=-1 then gosub X9 return X1: line a,b,c,d line a,b+10,c,d-10 return X2: line a+30,b,c+30,d line a+30,b+10,c+30,d-10 return X3: line a+60,b,c+60,d line a+60,b+10,c+60,d-10 return X4: line a,b-30,c,d-30 line a,b-20,c,d-40 return X5: line a+30,b-30,c+30,d-30 line a+30,b-20,c+30,d-40 return X6: line a+60,b-30,c+60,d-30 line a+60,b-20,c+60,d-40 return remstart line a,b,c,d line a,b+10,c,d-10 remend X7: line a,b-60,c,d-60 line a,b-50,c,d-70 return X8: line a+30,b-60,c+30,d-60 line a+30,b-50,c+30,d-70 return X9: line a+60,b-60,c+60,d-60 line a+60,b-50,c+60,d-70 return check: if onespace#+twospace#+threespace#=3 then goto p1win if onespace#+fourspace#+sevenspace#=3 then goto p1win if onespace#+fivespace#+ninespace#=3 then goto p1win if fourspace#+fivespace#+sixspace#=3 then goto p1win if sevenspace#+eightspace#+ninespace#=3 then goto p1win if eightspace#+fivespace#+twospace#=3 then goto p1win if ninespace#+sixspace#+threespace#=3 then goto p1win if sevenspace#+fivespace#+threespace#=3 then goto p1win if onespace#+twospace#+threespace#=-3 then goto p2win if onespace#+fourspace#+sevenspace#=-3 then goto p2win if onespace#+fivespace#+ninespace#=-3 then goto p2win if fourspace#+fivespace#+sixspace#=-3 then goto p2win if sevenspace#+eightspace#+ninespace#=-3 then goto p2win if eightspace#+fivespace#+twospace#=-3 then goto p2win if ninespace#+sixspace#+threespace#=-3 then goto p2win if sevenspace#+fivespace#+threespace#=-3 then goto p2win return p1win: print pl1name$;" wins" sleep 2000 cls do ink rgb(rnd(200),rnd(200),rnd(200)),rgb(0,0,0) dot rnd(600),rnd(450) loop p2win: print pl2name$;" wins" sleep 2000 cls do ink rgb(rnd(200),rnd(200),rnd(200)),rgb(0,0,0) dot rnd(600),rnd(450) loop red: re#=200 gr#=0 bl#=0 return green: re#=0 gr#=200 bl#=0 return blue: re#=0 gr#=0 bl#=200 return |