s3games.ai

## Class Puzzle8Heuristic

- java.lang.Object
- - s3games.ai.Heuristic
  - - s3games.ai.Puzzle8Heuristic

-     public class Puzzle8Heuristic
      extends Heuristic

  A heuristic class for the puzzle8 game. It calculates the sum of the Manhattan distances for all elements from their target locations. Use it with A* algorithm.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Puzzle8Heuristic()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `heuristic(GameState gameState, int forPlayer)` return a sum of distances to target locations of all elements

    - ### Methods inherited from class s3games.ai.Heuristic

      `availableHeuristics, getHeuristic`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Puzzle8Heuristic

          public Puzzle8Heuristic()

  - ### Method Detail

    - #### heuristic

          public double heuristic(GameState gameState,
                         int forPlayer)

      return a sum of distances to target locations of all elements
      Specified by:
        `heuristic` in class `Heuristic`
      Parameters:
        `gameState` - current game state
        `forPlayer` - current player
      Returns:
        estimated value of the current game state