Best heuristic feature for the game (AI Minimax)

There is a game that I programmed in java. The game is simple (see picture below). There are 4 birds and 1 larva. This is a two-player game (AI vs Human).

enter image description here

  • The larva can move diagonally forward and diagonally backward.
  • Birds can ONLY move diagonally forward.
  • The larva wins if it can get to line 1 (fence)
  • The larva also wins if the birds have no moves.
  • Birds DO NOT "eat" the larva.
  • Birds win if Larva has NO move to the left (cannot move at all)

enter image description here

When the game begins, the larva begins, then ONE BIRD can move (any), then the Larva, etc.


I implemented MiniMax (Alpha Beta Pruning) and I use the following evaluation function () (heuristic function).

.

enter image description here

,

h (n) = - 1 - 2 - 3 - 4

,

:

enter image description here

. . , , , ?

/ ?

+4
3

:

:

:

H(t)=max_distance(larva,line_8)+Σmin_distance(bird_n,larva)

H(t)=Σmin_distance(bird_n,larva) - min_distance(larva,line_1)

max_distance (, _8): , 1.

Σmin_distance (bird_n, larva): , ( ).

, , , , , , , , , .

+2

1 . A1 8 A8. , , . . 1 . , 1 a 1, 2 a 2 .. , .

+2

, , , , Larva MAX, .

+1

Source: https://habr.com/ru/post/1615350/


All Articles