Milan Babuškov
Milan Babuškov

Reputation: 61158

How to create a reasonable AI?

I'm creating a logic game based on Fox and Hounds game. The player plays the fox and AI plays the hounds. (as far as I can see) I managed to make the AI perfect, so it never loses. Leaving it as such would not be much fun for human players.

Now, I have to dumb-down the AI so human can win, but I'm not sure how. The current AI logic is based on pattern-matching - if I introduce random moves which make the board go out of pattern space the AI would most probably play dumb until the end of the game.

I'm also thinking about removing a set of patterns, so it would seem as AI does not know that "trick" but this way players could find a way to beat the computer using the same moves every time.

Any ideas how to dumb down the AI in such way that is does not go from "genius" to "completely dumb" in a single move?

Upvotes: 6

Views: 1120

Answers (5)

lasantha
lasantha

Reputation: 865

  • I think this is a zero-sum game, and you can use the MinMax algorithm to solve the game instead of pattern matching, in that way by controlling the search depth you can control the level of expertise of the agent.
  • On the other hand you can use the A* search to determine the best move for a given fox/hound. And choosing different heuristics you can control the effectiveness if the agent.

Upvotes: 0

BlackBear
BlackBear

Reputation: 22989

Since I'm not an expert game developer and my AI is actually too dumb at the moment, I'd make a sort of 'learning AI'. Say you keep all your regexes disabled and you enable them once the player uses them.

Upvotes: 0

Milan Babuškov
Milan Babuškov

Reputation: 61158

I ended up creating a couple of quasi-smart pattern plays (as if a 10 year old might play) so it is not completely dumb, and then I pick one or two of those at random before the game starts. This way the game is always beatable, but the player does not know how (i.e. he cannot use the same strategy to always win, he has to explore for weak spot first).

Upvotes: 2

mrk
mrk

Reputation: 3191

If your game is a zero-sum one, the MiniMax algorithm with an alpha-beta optimization is a good choice. You can create difficulty levels by making the search stop when the algorithm reaches a certain depth.

Upvotes: 0

sternr
sternr

Reputation: 6516

We used MinMax as the AI algorithm for our game and we implemented the AI levels by setting different depth for each level

Upvotes: 2

Related Questions