org.jscience.computing.game.puzzle
Class TilePuzzlePlayer

java.lang.Object
  extended by org.jscience.computing.game.TemplatePlayer
      extended by org.jscience.computing.game.puzzle.TilePuzzlePlayer
All Implemented Interfaces:
java.io.Serializable, Player

public class TilePuzzlePlayer
extends TemplatePlayer

provides AI for a TilePuzzle game

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jscience.computing.game.TemplatePlayer
TemplatePlayer.MoveEvaluater, TemplatePlayer.Synchronizer
 
Field Summary
 
Fields inherited from class org.jscience.computing.game.TemplatePlayer
levelOverwrite, monitors, orderMoves, playerName, SEARCH_ALPHABETA, SEARCH_MINMAX, searchOption
 
Constructor Summary
TilePuzzlePlayer()
          Creates a new TilePuzzlePlayer object.
TilePuzzlePlayer(java.lang.String name)
          Creates a new TilePuzzlePlayer object.
TilePuzzlePlayer(java.lang.String name, int searchOption, boolean trackingEnabled)
          Creates a new TilePuzzlePlayer object.
TilePuzzlePlayer(java.lang.String name, int searchOption, boolean trackingEnabled, long randomSeed)
          Creates a new TilePuzzlePlayer object.
 
Method Summary
 boolean canPlayGame(GamePlay game)
          DOCUMENT ME!
 double heuristic(GamePlay game, GameMove move, int[] role)
          DOCUMENT ME!
static int manhattanDistance(TilePuzzle game)
          DOCUMENT ME!
static double nielsson(TilePuzzle game)
          DOCUMENT ME!
static int outOfPlace(TilePuzzle game)
          DOCUMENT ME!
 void setRandomSeed(long seed)
          if seed = 0, randomization is disabled
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.computing.game.TemplatePlayer
disableTracking, enableTracking, evaluate, evaluate, getLevelOverwrite, getMonitors, getOrderMoves, getPlayerName, getSearchOption, numberOfPositionsSearched, numberOfRequests, performanceRatio, pruneMove, selectMove, setLevelOverwrite, setOrderMoves, setPlayerName, setSearchOption, setTracking, statsAsString, totalTimeTaken, trackingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TilePuzzlePlayer

public TilePuzzlePlayer()
Creates a new TilePuzzlePlayer object.


TilePuzzlePlayer

public TilePuzzlePlayer(java.lang.String name)
Creates a new TilePuzzlePlayer object.

Parameters:
name - DOCUMENT ME!

TilePuzzlePlayer

public TilePuzzlePlayer(java.lang.String name,
                        int searchOption,
                        boolean trackingEnabled)
Creates a new TilePuzzlePlayer object.

Parameters:
name - DOCUMENT ME!
searchOption - DOCUMENT ME!
trackingEnabled - DOCUMENT ME!

TilePuzzlePlayer

public TilePuzzlePlayer(java.lang.String name,
                        int searchOption,
                        boolean trackingEnabled,
                        long randomSeed)
Creates a new TilePuzzlePlayer object.

Parameters:
name - DOCUMENT ME!
searchOption - DOCUMENT ME!
trackingEnabled - DOCUMENT ME!
randomSeed - DOCUMENT ME!
Method Detail

canPlayGame

public boolean canPlayGame(GamePlay game)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
Returns:
DOCUMENT ME!

setRandomSeed

public void setRandomSeed(long seed)
if seed = 0, randomization is disabled

Parameters:
seed - DOCUMENT ME!

heuristic

public double heuristic(GamePlay game,
                        GameMove move,
                        int[] role)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
move - DOCUMENT ME!
role - DOCUMENT ME!
Returns:
DOCUMENT ME!
See Also:
TemplatePlayer

nielsson

public static double nielsson(TilePuzzle game)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
Returns:
DOCUMENT ME!

manhattanDistance

public static int manhattanDistance(TilePuzzle game)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
Returns:
DOCUMENT ME!

outOfPlace

public static int outOfPlace(TilePuzzle game)
DOCUMENT ME!

Parameters:
game - DOCUMENT ME!
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class TemplatePlayer
Returns:
DOCUMENT ME!