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

Username:   Password: 
 RegisterRegister   
 help me plz
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
meidan




PostPosted: Wed Jun 14, 2006 8:12 pm   Post subject: help me plz

how do you make a computer opponent in tic tac toe?
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: Wed Jun 14, 2006 8:14 pm   Post subject: (No subject)

you can have a whole bunch of if statements where if this square and this square is taken, then the opponent must go in this square to block me off.
meidan




PostPosted: Wed Jun 14, 2006 8:17 pm   Post subject: (No subject)

ok i know the logic but how do i say that this square is blocked and for it to go to the other square?
CodeMonkey2000




PostPosted: Wed Jun 14, 2006 8:22 pm   Post subject: (No subject)

mark it.
sqre 1 is taken, so sqre1=1 and squr2 is taken sor squr2=1
if sqre1 and sqre2 =1 then you have to go to sqre3 etc...
Tony




PostPosted: Wed Jun 14, 2006 8:41 pm   Post subject: (No subject)

meidan wrote:
ok i know the logic but how do i say that this square is blocked and for it to go to the other square?

how do you know if the square is blocked or not for the human player? same approach.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
meidan




PostPosted: Wed Jun 14, 2006 8:47 pm   Post subject: (No subject)

ok i understand but i made my sqaures like this...

i made a box and said the coordinates so like

x >100 but <200 and y> 300 but <500 so how do i make this as a variable???
CodeMonkey2000




PostPosted: Wed Jun 14, 2006 8:52 pm   Post subject: (No subject)

are you using ifs? because if you are, then you can have it within the if statement. eg. if x>30 and y<90 then squre x is taken.
Tony




PostPosted: Wed Jun 14, 2006 8:54 pm   Post subject: (No subject)

perhaps you should figure out how to let a user play, before attempting to figure out how to have a computer play.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: