Advertisement

what is the best way to design ai for games like x-o or chess

Started by May 28, 2015 08:41 PM
10 comments, last by Dave Hunt 9 years, 5 months ago

hello my friends.

im working on a project like x-o and it happens in static discrete world. and im working on unity and scripting on c#.

in basic ai science the ai is implemented in space of states(i dont know the exact translation in english) but i think its a big work to make all of states and it need lots of process and work to do that and for a game you have to make different difficulities for the game and always choosing best move cantbe great.

i want to know what can be best choice to implement ai for these kinds of games.

thank you for helping me.

I have a lot of experience writing AI for board games, but I don't know enough about your game to give you solid advice.
Advertisement

I have a lot of experience writing AI for board games, but I don't know enough about your game to give you solid advice.

thank you for answering. just tell me how you write ai for a game like chess or x-o and i will expand and optimize it to my game.

thanks.

Is "x-o" a different name for Tic-Tac-Toe?

Hello to all my stalkers.

In my current course, we've been covering Minimax, Game Tree Theory and Monte Carlo.

These are good topics to research and implement for a fairly simple game like checkers, tic-tac-toe.

A major benefit of these approaches is that you can cut the search short and still have a fairly good set of decisions for your AI to use.

You're right that always choosing the best move is not the best approach, one of the major parts of AI for games is to make them enjoyable, which usually means humanising them.

You may also want to poke machine learning and genetic algorithms, so you can train your AI to identify and conquer patterns.

Engine, graphics, low-level, security and cross-platform programming. xsngine

I have a lot of experience writing AI for board games, but I don't know enough about your game to give you solid advice.

thank you for answering. just tell me how you write ai for a game like chess or x-o and i will expand and optimize it to my game.
thanks.


There is a Wiki page devoted to how to make AI for chess at https://chessprogramming.wikispaces.com/ . Start there.
Advertisement


i want to know what can be best choice to implement ai for these kinds of games.

The best choice is whatever makes your game work the way you want it to. There is no "best" way to do AI.

Check out the links provided in the previous posts and make use of Google to add to your research. Gather the ideas together and see what best fits the needs of your game.

Is "x-o" a different name for Tic-Tac-Toe?

yes my friend.

Seeing as the technique for doing base AI for those games is often referred to as a "chess tree search", that probably answers your question. But yes, the prohibition in chess is the explosion in the number of potential game states. That's not the issue with smaller games like... whatever we are calling the X and O thingy.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

For a more complete answer, here's an improvised classification of algorithms to play board games:
* Ad-hoc set of rules
* Minimax and its derivatives (alpha-beta, NegaMax, PVS, ...)
* Monte Carlo Tree Search
* Generating an exhaustive database, using retrograde analysis
* Artificial Neural Networks (can be used by themselves or in combination with minimax or MCTS).

For some games (e.g., tic-tac-toe) pretty much any of those approaches would work, but a set of ad-hoc rules ends up being unmanageable and brittle for all but the simplest of games.

For most two-player zero-sum deterministic games (chess, checkers, connect 4...), minimax is the obvious choice. If the game tree is small enough, you can explore the entire game tree, but for most interesting games this is unfeasible, so you can only explore a subtree, using a heuristic evaluation function at the leaves.

MCTS works for a much larger class of games, including games with more than two players, games with simultaneous decisions, games with randomness... It can even work with hidden information, but that can get tricky quickly. It is also the case that MCTS works better than minimax for games where it is hard to write a decent heuristic evaluation function (the obvious example is go).

Generating databases with retrograde analysis is useful primarily in games where the board gets simpler in the endgame, like chess and checkers. It can also be used to strongly solve the entire game, like it was done for the mancala variant Awari.

ANNs have been used recently to predict moves in go (there were two papers about it in arXiv.org in December), and I have been using them recently as evaluation functions (they worked really well for me in Spanish checkers).

I left some more exotic techniques out of the list. In particular I can think of Proof Number Search, algorithmic game theory (to understand games like Nim and dots and boxes) and Linear Programming (for poker), which are interesting but I don't feel like describing them here.

This topic is closed to new replies.

Advertisement