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

Username:   Password: 
 RegisterRegister   
 Is it possible to make my tic tac toe game think for itself?
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Cancer Sol




PostPosted: Sun Mar 17, 2013 8:18 pm   Post subject: Is it possible to make my tic tac toe game think for itself?

I'm just wondering... is it possible to make my tic tac toe game in the single player mode to think for itself? I don't want to do a million if statements, that would make my code long and hard to read. If so, what is the function called? I want to check if my ebook shows it Razz
Thanks.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Mar 17, 2013 8:50 pm   Post subject: RE:Is it possible to make my tic tac toe game think for itself?

It's much less than a million statements. You just read the move from this map ? http://xkcd.com/832/
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Insectoid




PostPosted: Mon Mar 18, 2013 1:17 am   Post subject: RE:Is it possible to make my tic tac toe game think for itself?

Quote:
what is the function called?

This question almost never has an answer. When trying to do something, don't even ask if a function exists for it. Try to make it yourself. 99% of the time, you have to anyway because the function you want doesn't exist.
Cancer Sol




PostPosted: Mon Mar 18, 2013 12:00 pm   Post subject: Re: RE:Is it possible to make my tic tac toe game think for itself?

Tony @ 3/17/2013, 8:50 pm wrote:
It's much less than a million statements. You just read the move from this map ? http://xkcd.com/832/

I don't know, I don't really get what it's trying to show Razz
My brother is good at tic tac toe, so I'll just ask him for all the different possibilities then xD

@Insectoid Lol alright Razz
Raknarg




PostPosted: Mon Mar 18, 2013 12:06 pm   Post subject: RE:Is it possible to make my tic tac toe game think for itself?

basically you just want the program to calculate the best move. There's different ways to do that. However, Tic Tac Toe has been solved, such as what the xckd comic shows: there's a best move for any situation
evildaddy911




PostPosted: Mon Mar 18, 2013 3:52 pm   Post subject: RE:Is it possible to make my tic tac toe game think for itself?

you never want the game to be impossible, so have the computer pick the perfect move say... 60% of the time. however, once that happens, the map is useless. So you may then have to start going randomly after that
Cancer Sol




PostPosted: Wed Mar 20, 2013 6:55 pm   Post subject: Re: Is it possible to make my tic tac toe game think for itself?

@Tony Btw, I forgot to mention that I was just using exaggeration XD


I'm working on an AI now.
On easy mode, the AI only knows how to get 3 O's in a row, or block. It also knows how to mark an 'O' at a random square too.
On medium mode, I'm having the AI also use traps, and blocks traps, along with above.
On hard mode, I'm going to try and have the AI detect if it should complete a trap or not, depending if the enemy blocked the squares that would render the trap useless. (Sorry if I didn't make any sense)
I was planning on making an Insane mode that can't be beat, but that might be kinda hard, and maybe I shouldn't Razz
Raknarg




PostPosted: Wed Mar 20, 2013 7:42 pm   Post subject: RE:Is it possible to make my tic tac toe game think for itself?

I would implement it, and then create a game that isn't redundant but with the same idea, like gridlock.
Sponsor
Sponsor
Sponsor
sponsor
Cancer Sol




PostPosted: Sun Mar 24, 2013 5:39 pm   Post subject: Re: RE:Is it possible to make my tic tac toe game think for itself?

Raknarg @ 3/20/2013, 7:42 pm wrote:
I would implement it, and then create a game that isn't redundant but with the same idea, like gridlock.


What do you mean by that? Use the same kind of idea for another game?

I've got my tic tac toe game... or so I thought. I can't get it to work properly Sad
I'm just going to go look at some examples online right now.
Raknarg




PostPosted: Sun Mar 24, 2013 5:55 pm   Post subject: RE:Is it possible to make my tic tac toe game think for itself?

yup, it's basically a really big version that takes 5 in a row to win, and it actualy has strategy involved ratehr than tic tac toe, which is a solved game
Cancer Sol




PostPosted: Sun Mar 24, 2013 7:32 pm   Post subject: Re: RE:Is it possible to make my tic tac toe game think for itself?

Raknarg @ 3/24/2013, 5:55 pm wrote:
yup, it's basically a really big version that takes 5 in a row to win, and it actualy has strategy involved ratehr than tic tac toe, which is a solved game

I can't even make a tic tac toe game properly yet, LOL xD
Well my two player tic tac toe game is alright, but the AI is messed up
Sly14Cat




PostPosted: Wed Apr 10, 2013 6:35 pm   Post subject: RE:Is it possible to make my tic tac toe game think for itself?

Cancer Sol I think if you plan on going all out in an AI, it shouldn't be tic tac toe. Your ideas sound like they belong to a more complex game such as a card game. But sure go for the ttt AI though.
Cancer Sol




PostPosted: Wed Apr 10, 2013 7:33 pm   Post subject: Re: RE:Is it possible to make my tic tac toe game think for itself?

Sly14Cat @ 4/10/2013, 6:35 pm wrote:
Cancer Sol I think if you plan on going all out in an AI, it shouldn't be tic tac toe. Your ideas sound like they belong to a more complex game such as a card game. But sure go for the ttt AI though.

I stopped making it, which I'm planning on making a card game later on.
For now, I'll just try and learn more of the content in "Jumping into C++".
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: