0

So I am working on a artificial intelligent assistant that is supposed to help you making correct decision when playing the game domino. Basic rules: http://www.pagat.com/tile/wdom/caribbean.html

As this game has several rules and several different ways you can play a domino to ultimately win the game. Now the question becomes what is the best way to determine what domino is the best domino to be played?

Extremely large else if statements nested and what not? or a ranking based system?

closed as too broad by durron597, GlenH7, user22815, Kilian Foth, Dan Pichelman Jul 6 '15 at 13:01

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    This question is a bit broad: what have you tried so far? What specifically do you not understand? Please read: Where to start? – user22815 Jul 3 '15 at 0:09
2

The simplest thing to do is write a function that takes a board state and gives you back a score for that board state. You then enumerate over all of the possible boards and chose the best one. That's really at the heart of it.

Consider the game tic-tac-toe for a moment. Lets consider the person scoring 1 point for each X in a row, column, or diagonal and -1 point point for each O in a row, column, or diagonal (and rows or diagonals with at least one X and O are also scored as 0).

 X |   |     ||  X |   | X   ||  X | X |    ||  X |   |
---+---+---  || ---+---+---  || ---+---+--- || ---+---+---
   | O |     ||    | O |     ||    | O |    ||    | O | X
---+---+---  || ---+---+---  || ---+---+--- || ---+---+---
   |   | X   ||    |   |     ||    |   |    ||    |   |
Score: 1     || Score: 1     || Score: 1    || Score: 1

I won't claim that this is the best heuristic for tic-tac-toe, but you get the idea of the idea of a function to evaluate the board state.

That's really at the heart of the game. Here are two boards - which one is 'better'. Better could be a "how many moves from a potential win" or "which has more winning possibilities" or any number of other position evaluation functions.

In a game where there is the ability to guess at the next play of the opponent, you get into writing a minimax tree where you try to decide upon the move that still gives you best evaluation for you after your opponent has made the one that is the worst for you. This isn't a small topic, as noted there is a fairly good sized wikipedia page on it with 13 other pages in the see and many external links and references. This is a fairly big area of game theory - and if you want to explore that it is the subject of books, multiple college lectures and papers resulting in something too large to reasonably answer here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.