0
\$\begingroup\$

I am currently developing a Puzzle/RPG game which works a little bit like Minesweeper.
You have a Field of Tiles and 2, 3 or 4 different colors from which you can choose. Now you have to uncover tiles in order to attack the enemy.
Therefore you need to choose the correct color for the tile you want to open. If you try the wrong color, the enemy may try. As long as you open tiles, the enemy may not try (same if it's the enemy's turn).

Now I wrote a really simple AI which works like this:
It iterates over the complete field and looks for all unopened tiles. For each of this unopened tiles, it calculates a score, depending on the tile's neighbours. So an unopened neighbour gives +0, an opened neighbour with a 0 gives +4, an opened neighbour with a 4 gives +4, with 3 gives +3 and so on.
At the end the score is weighted, depending on the fact how many different colours the neighbours have and how many beighbours it actually has (because tiles at the edge have less neighbours).

When it comes to choosing a tile, it works pretty well. Then for the chosen tile it tries every colour, starting with some colour of the neighbouring open tiles. But the ai has no understanding for what the neighbours can tell it. So there is no actual strategy except of: Look for a tile, try colours until it is opened.

I am really new in AI development and find it pretty hard to wrap my head around that topic. The only AI I wrote before was some simple chasing in 2D space shooter.

So my question is: How would a good AI in such a case look?
I thought it would be best to give the AI the same information as the player. So it only knows Tile count and which tiles are opened/closed and the colours of the opened and their neighbour counts. Is this correct or should the AI know everything?
Addtionally, the AI should be beatable.
Can you give me some hints on how this can be/should be/usually is done? Or is there some literature you can recommend for this topic?
(I already looked in an AI for games book I have here and thought I could use minimax but I could not find out how. Also I thought maybe seeing this problem as pathfinding problem would be a solution, but I am not quite sure.)

For better understanding, this is a game which works like what I am building, except this game has no AI and no rela enemy turns (The player just gets hit if he clicks a wrong tile): GameLink

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Two very general suggestions --

  1. Often in board games a good human player runs through a list of rules or if-this-then-that mentally. If you can understand what a good human player in your game would do, then it's just a matter of translating that into code. This is generally referred to as "rules-based AI". If the game is strategically simple, then building these rules by hand is not difficult.

  2. As for how to make an AI beatable, start with an implementation of the best possible AI. Once you have that, begin to insert "mistakes". Perhaps x% of the time, the best move to make is replaced with a randomly chosen non-best move, where x can vary according to "difficulty".

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .