Skip to content

Heuristics

Raluca D. Gaina edited this page Jun 4, 2019 · 1 revision

All heuristics can be found in package players.heuristics. CustomHeuristic and AdvancedHeuristic work by evaluating any given states in relation to a root state (thus the agents must indicate root states before evaluating simulated states). They all extend the StateHeuristic class (any new functions added should also do so).

Win Score Heuristic

WinScoreHeuristic()

The simplest heuristic, it returns 1 if the player won the game, -1 if they lost, 0.5 if they tied or 0 otherwise.

Player Count Heuristic

PlayerCountHeuristic()

An extension of the simplest heuristic, it returns 1 if the player won the game, -1 if they lost, 0.5 if they tied or 1/playerCount otherwise, where playerCount is the number of players alive in the game, excluding the evaluating player.

Custom Heuristic

CustomHeuristic(GameState root)

The value returned by this heuristic is calculated as the difference between the root game state and the evaluated state, based on a series of features:

  • number of alive teammates (weight = 0.1; or 0 in FFA games)
  • number of alive enemies (weight = 0.13; or 0.17 in FFA games)
  • number of existing wooden blocks (weight = 0.1)
  • blast strength (weight = 0.15)
  • the ability to kick bombs (weight = 0.15)

The value of the state is calculated as a weighted sum of all features / 2 (value is in [-0.5, 0.5]). Additionally, it simply returns 1 if the player won the game, and -1 if they lost.

Advanced Heuristic

AdvancedHeurisic(GameState root)

The value returned by this heuristic is calculated as the difference between the root game state and the evaluated state, based on a series of features:

  • number of alive teammates (weight = 0.1; or 0 in FFA games) FACTOR_TEAM
  • number of alive enemies (weight = 0.2; or 0.3 in FFA games) FACTOR_ENEMY
  • number of existing wooden blocks (weight = 0.05)
  • blast strength (weight = 0.05)
  • the ability to kick bombs (weight = 0.05)
  • number of safe directions (weight = 0.2)
  • number of bomb directions (weight = 0.2)
  • distance to the closest enemy (weight = 0.1)
  • if enemy is adjacent to player (weight = 0.12)
  • distance to the closest power-up (weight = 0.05)

The value of the state is calculated as a weighted sum of all features / 2 (value is in [-0.5, 0.5]). Additionally, it simply returns 1 if the player won the game, and -1 if they lost.