s3games.ai

## Class Heuristic

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

- Direct Known Subclasses:
    DistanceFromGoalHeuristic, MoreStonesHeuristic, Puzzle8Heuristic

      public abstract class Heuristic
      extends java.lang.Object

  An abstract heuristic class, also contains a constructor method given the heuristic name

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Heuristic()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String[]` | `availableHeuristics(java.lang.String gameName)` lists all the heuristics available in the system
    `static Heuristic` | `getHeuristic(java.lang.String name, GameSpecification specs)` constructor method that creates a heuristic of the specified type
    `abstract double` | `heuristic(GameState gameState, int forPlayer)` a heuristic receives the current state and player number - from whose viewpoint the game situation is to be evaluated.

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

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

- - ### Constructor Detail

    - #### Heuristic

          public Heuristic()

  - ### Method Detail

    - #### heuristic

          public abstract double heuristic(GameState gameState,
                         int forPlayer)

      a heuristic receives the current state and player number - from whose viewpoint the game situation is to be evaluated. A heuristic should return a number that estimates how good the sitation is for the player: in A* this is a lower bound of distance to a goal state, for A* it is a value between -1 (worst=always losing state) and +1 (good=always winning state)
      Parameters:
        `gameState` - current game state
        `forPlayer` - current player
      Returns:
        estimated value of the current game state

    - #### availableHeuristics

          public static java.lang.String[] availableHeuristics(java.lang.String gameName)

      lists all the heuristics available in the system

    - #### getHeuristic

          public static Heuristic getHeuristic(java.lang.String name,
                               GameSpecification specs)

      constructor method that creates a heuristic of the specified type
      Parameters:
        `name` - heuristic name
        `specs` - game specification that is passed to the heuristic constructor if it is needed
      Returns:
        a new instance of the specified heuristic