Question:
What is the algorithm needed to make a man vs pc tic tac toe game ?
Asad
2012-10-23 20:40:06 UTC
It will not be a regular tic tac toe game with only 9 spots. The board will be bigger and much more spots will be available. The player who matches 5 symbols in a row will win the match. Just like the tic tac toe game on facebook.

Now i am developing my game and i want to keep an option that a person will be able to play with the computer. Now i need the name of the algorithm using which i can do so. I have heard that BFS will do this, though i am not sure.

SERIOUS answers please. I need help.
Four answers:
FstaRocka
2012-10-23 20:49:09 UTC
a hit algorithm wont be hard, its the calculating of the next move that will be quite mighty.. depending on what u are using - it will have to be a very dynamic piece of work.



I would imagine you would try this logic:



lets say u want to work at getting 5:



look for and count 4's of your side and fill if possible. then look for 4 of opponent - on finding any, u will need to have some sort of risk checker (is it close to the side, etc) and work from there.



you will have to pay attention and look for a winning move first, an opponents winning move second (analyze that and look for options)..



you could also make a large collection of functions for various fluid setups..



this will def be trial and error.. you will have to count open possibilities with each move and build an AI on that
BlackBelt2025
2012-10-23 20:53:12 UTC
You can use a MinMax algorithm.



I actually did a project just like this a a year and a half ago. What I did for the computer player was this: search for lines where there are 4 of the same symbols in a row. If the symbol is the computer's, put another symbol to win. If it is the player's symbol, store the coordinates of the game spaces, and keep checking to see if the computer can win. if not, then block the player. If there is no 4 symbols in a row, check for 3 in the same manner, then 2, then finally 1.
lasley
2016-12-12 16:45:22 UTC
I as quickly as met a guy who'd been given a central authority grant to coach chickens to play tic tac toe. He in certainty taught the chickens to %. a sequence form of strikes, because of the fact the sport isn't that complicated. seems chickens are as solid as human beings at tic tac toe.
?
2012-10-23 20:51:01 UTC
This is vary well examined field

Here are some comment othere programmers have said.

http://stackoverflow.com/questions/9388474/how-to-code-simple-ai-for-a-windows-phone-board-game



Here is the theoretical bakground on a common game technique

http://en.wikipedia.org/wiki/Alpha-beta_search


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...