Heuristic function for Pylos game

124 Views Asked by At

Pylos is a game constituted of a 4x4 pyramid board (4x4 below a 3x3 below a 2x2 below a 1). There are two players, one with White marbles and the other with Black marbles.

Each player has 15 marbles initially and takes turns placing a marble on the board on a free square (or if it is on a higher level, the 4 'support' squares of the lower level must be occupied). The goal is that the opponent has no more marbles in his stock. If you complete a square of marbles of the same color, you can remove two of your marbles from the board. If you can move a marble to a higher level, you can do so (you save putting down a marble).

In short, my goal is to implement the best possible strategy for this game. For that, I have implemented a MinMax and I need a heuristic evaluation function. I can't go deeper than depth 4 in MinMax.

The naive heuristic returns the difference between my number of marbles in stock and that of my opponent.

I have tried to improve the heuristic by implementing same-color square detection, and upward movement detection, and also by giving importance to constraining an opponent's move, but the naive strategy sometimes still wins if it plays 2nd.

If you have any ideas for improvement, I would be grateful.

0

There are 0 best solutions below