Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 tic tac toe game, please help finish
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
littenburg




PostPosted: Wed Jan 16, 2008 9:17 am   Post subject: tic tac toe game, please help finish

i have started my project in turing, but now im stuck, i have to make a tick tac toe game againts the computer, please someone help. Confused


here is my code, i did have some fun with it...


%the tic tac toe game
%buahahaha

%below are all my variables
var u : array 1 .. 5 of string
var c : array 1 .. 5 of string
var firstplayer : string
var command : string (1)
var point, roll : int
var one : string := "human will go first"
var two : string := "computer will go first"
var it : real
var fun, fun2, fun3, fun4, fun5 : int

%below is my randamizer for all the fun colours in the game
randint (fun, 1, 25)
randint (fun2, 26, 50)
randint (fun3,51, 75)
randint (fun4, 76, 100)
randint (fun5, 101, 125)


colourback (black)
cls
colour (white)
%below, i made it so that the introduction appears in the centre of the screen
procedure CentreText (s : string, row : int)
locate (row, (maxcol - length (s)) div 2)
put s
View.Update
end CentreText
delay(650)
CentreText ("IT'S THE TIC TAC TOE GAME!!!", maxrow div 2 - 7)
CentreText ("Created by someone", maxrow div 2 - 5)
delay(700)
CentreText ("~Now Loading Game~", maxrow div 2 - 3)
delay (500)
CentreText (". . . ", maxrow div 2 - 1)%all this is just for fun, i wanted it to look cool, and like it was actually loading somthing.
delay (500)
CentreText (" . . .", maxrow div 2 - 1)
delay (500)
CentreText (". . . ", maxrow div 2 - 1)
delay (500)
CentreText (" . . .", maxrow div 2 - 1)
delay (500)
CentreText (". . . ", maxrow div 2 - 1)
delay (500)
CentreText (" . . .", maxrow div 2 - 1)
delay (500)
CentreText (". . . ", maxrow div 2 - 1)
delay (500)
CentreText (" . . .", maxrow div 2 - 1)
delay (501)
CentreText ("READY!", maxrow div 2 - 1)
delay (1000)
CentreText ("YAY", maxrow div 2-0)
delay(1000)
cls
colourback (fun2)
cls
colour (fun3)
%below is the area for asking who will go first, the chicken or the egg, I meen human or computer.
put "press 1 for human(you), or 2 for computer to go first"
getch (command)
for i : 1 .. 1
if command = "1" then
put one
else
if command = "2" then
put two

end if
end if
end for
delay (1000)
cls
colourback (fun2)
cls
colour (fun3)

%Below, I have the cross diagram you must draw to play TIC TAC TOE

cls
drawfillbox (135, 0, 131, maxy, fun)
drawfillbox (265, 0, 269, maxy, fun5)
drawfillbox (385, 135, 0, 131, fun3)
drawfillbox (385, 265, 0, 269, fun4)
Sponsor
Sponsor
Sponsor
sponsor
syntax_error




PostPosted: Wed Jan 16, 2008 9:49 am   Post subject: Re: tic tac toe game, please help finish

hint use a 2D array to rep the grid in the memory
then play some tic tack toe and figure out the logic behind the simple game...
and then WRITE it on PAPER then think of the syntax in turing
Tony




PostPosted: Wed Jan 16, 2008 10:23 am   Post subject: RE:tic tac toe game, please help finish

another hint: it is _much_ easier to make a 2 player tic-tac-toe game, than one against a computer. Make a 2 player game first, then simply drop in an AI that will determine the move of the 2nd player, but only after the game mechanics are finished.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
littenburg




PostPosted: Wed Jan 16, 2008 6:53 pm   Post subject: Re: tic tac toe game, please help finish

im clueless when it comes to turing, it has taken me 2 months just to do this Sad
Tony




PostPosted: Wed Jan 16, 2008 7:13 pm   Post subject: Re: tic tac toe game, please help finish

littenburg -
[quote="syntax_error @ Wed Jan 16, 2008 9:49 am"]play some tic tack toe and figure out the logic behind the simple game...
and then WRITE it on PAPER[/quote
This has nothing to do with Turing, so you shouldn't have problems with the above steps

Once you know what you want to do, it's really easy to help you get it working.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: