org.jscience.computing.game.puzzle
Class EightQueens

java.lang.Object
  extended by org.jscience.computing.game.AbstractGame
      extended by org.jscience.computing.game.puzzle.EightQueens
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, GamePlay

public class EightQueens
extends AbstractGame

EightQueens implements the problem of placing 8 queens on a chess board so that they don't attack each other. The Solution is found here after searching through 25944 positions without any specific AI (giving an indication about the complexity of the puzzle).

See Also:
Serialized Form

Constructor Summary
EightQueens()
          Creates a new EightQueens object.
 
Method Summary
 java.lang.Object clone()
          DOCUMENT ME!
 int[] getWinner()
          DOCUMENT ME!
protected  GameMove[] listLegalMoves()
          DOCUMENT ME!
static void main(java.lang.String[] args)
          solves the puzzle and fires up a JGameFrame that lets you examine the solution
 int nextPlayer()
          DOCUMENT ME!
protected  boolean popMove()
          DOCUMENT ME!
protected  boolean pushMove(GameMove move)
          DOCUMENT ME!
static GamePlay searchSolution()
          tries to solve the puzzle with GameUtils functions
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.computing.game.AbstractGame
clearRedoList, gameOver, getGameName, getLastMove, getLastPlayer, getLegalMoves, getLegalMoves, getMoveHistory, getNumberOfRedoMoves, getRedoList, getResult, isLegalMove, isWinner, loadFromFile, makeMove, numberOfMoves, numberOfPlayers, redoMove, resetLegalMoves, resetLists, saveToFile, spawnChild, undoLastMove, undoMoves
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EightQueens

public EightQueens()
Creates a new EightQueens object.

Method Detail

main

public static void main(java.lang.String[] args)
solves the puzzle and fires up a JGameFrame that lets you examine the solution

Parameters:
args - DOCUMENT ME!

searchSolution

public static GamePlay searchSolution()
tries to solve the puzzle with GameUtils functions

Returns:
DOCUMENT ME!

listLegalMoves

protected GameMove[] listLegalMoves()
DOCUMENT ME!

Specified by:
listLegalMoves in class AbstractGame
Returns:
DOCUMENT ME!

pushMove

protected boolean pushMove(GameMove move)
DOCUMENT ME!

Specified by:
pushMove in class AbstractGame
Parameters:
move - DOCUMENT ME!
Returns:
DOCUMENT ME!

popMove

protected boolean popMove()
DOCUMENT ME!

Specified by:
popMove in class AbstractGame
Returns:
DOCUMENT ME!

nextPlayer

public int nextPlayer()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getWinner

public int[] getWinner()
DOCUMENT ME!

Returns:
DOCUMENT ME!

toString

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

Overrides:
toString in class AbstractGame
Returns:
DOCUMENT ME!

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
DOCUMENT ME!

Specified by:
clone in interface GamePlay
Overrides:
clone in class AbstractGame
Returns:
DOCUMENT ME!
Throws:
java.lang.CloneNotSupportedException - DOCUMENT ME!
See Also:
AbstractGame.spawnChild(GameMove)