0

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.

mog
  • 1
  • I would say depth 4 is extremely low for this simple game, you should be able to go way deeper. With depth 4 you don't get a good ai no matter how good evaluation function you have. Try to optimize the move generation and minimax (preferably negamax) first and use your basic heuristics. You should easily be able to go to depth 15-20 without much effort due to the low branching factor. – eligolf Dec 21 '22 at 09:16
  • Problem is, I can't optimize minmax or other things as this is part of a coding challenge in which I can only modify the heuristics. Hence I can't optimize anything other than the heuristic. With depth 8, my computer processes for more than a minute at each turn (Python...) My heuristic will then fight against other heuristics. I therefore wondered if there was a way to take into account how the opponent played, but I haven't found anything yet. Thanks – mog Dec 21 '22 at 17:40
  • I see! I assume you want to remove marbles from the board, so trying to get a 2x2 square of own color should be preferable. You could count how many own color marbles are next to eachother and try to get as many as possible. – eligolf Dec 22 '22 at 08:50

0 Answers0