aigames.soccer.field
Class BasicGameField

java.lang.Object
  extended byaigames.soccer.field.BasicGameField
All Implemented Interfaces:
GameField

public class BasicGameField
extends java.lang.Object
implements GameField

Version:
$Id: BasicGameField.java,v 1.10 2004/05/08 21:55:25 mwerla Exp $

Constructor Summary
BasicGameField(Constructor fieldConstructor)
          Class contructor which uses given field constructor to create new field.
 
Method Summary
 float getAvgMoveLength(int color)
          Returns average move length for a given color.
 java.awt.Point getCurrentPosition()
          Returns current position of a ball.
 FieldPoint getFieldPoint(int x, int y)
          Returns field point at given coordinates.
 int getMaximumXIndex()
          Returns maximum X index.
 int getMaximumYIndex()
          Returns maximum Y index.
 int getNumberOfMoves(int color)
          Returns number of moves for a given color.
 boolean isDeadLock()
          Checks if there is ball deadlock.
 boolean isGameOver()
          Checks if there is game over.
 int isGoal()
          Checks if there is goal.
 void makeMove(Move move, int color)
          Makes move for a proper player.
 void startGame()
          Sets the ball in the starting position of the field and sets starting player according to given parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicGameField

public BasicGameField(Constructor fieldConstructor)
Class contructor which uses given field constructor to create new field.

Parameters:
fieldConstructor - Field constructor used to create new field.
Method Detail

makeMove

public void makeMove(Move move,
                     int color)
              throws InvalidMoveException
Description copied from interface: GameField
Makes move for a proper player.

Specified by:
makeMove in interface GameField
Parameters:
move - Move that will be made.
color - Color for the new move.
Throws:
InvalidMoveException - Thrown when move is invalid for current game field state.
See Also:
GameField.makeMove(Move, int)

isDeadLock

public boolean isDeadLock()
Description copied from interface: GameField
Checks if there is ball deadlock.

Specified by:
isDeadLock in interface GameField
Returns:
True if there is ball deadlock, otherwise false.
See Also:
GameField.isDeadLock()

getCurrentPosition

public java.awt.Point getCurrentPosition()
Description copied from interface: GameField
Returns current position of a ball.

Specified by:
getCurrentPosition in interface GameField
Returns:
Current position of a ball.
See Also:
GameField.getCurrentPosition()

startGame

public void startGame()
Description copied from interface: GameField
Sets the ball in the starting position of the field and sets starting player according to given parameter.

Specified by:
startGame in interface GameField
See Also:
GameField.startGame()

isGoal

public int isGoal()
Description copied from interface: GameField
Checks if there is goal.

Specified by:
isGoal in interface GameField
Returns:
-1 (left side) or 1 (right side) if there is goal, otherwise 0.
See Also:
GameField.isGoal()

isGameOver

public boolean isGameOver()
Description copied from interface: GameField
Checks if there is game over.

Specified by:
isGameOver in interface GameField
Returns:
True if there is game over, otherwise false.
See Also:
GameField.isGameOver()

getNumberOfMoves

public int getNumberOfMoves(int color)
Description copied from interface: GameField
Returns number of moves for a given color.

Specified by:
getNumberOfMoves in interface GameField
Parameters:
color - Color to check.
Returns:
Number of moves for a given color.
See Also:
GameField.getNumberOfMoves(int)

getAvgMoveLength

public float getAvgMoveLength(int color)
Description copied from interface: GameField
Returns average move length for a given color.

Specified by:
getAvgMoveLength in interface GameField
Parameters:
color - Color to check.
Returns:
Average move length for a given color.
See Also:
GameField.getAvgMoveLength(int)

getFieldPoint

public FieldPoint getFieldPoint(int x,
                                int y)
Description copied from interface: GameField
Returns field point at given coordinates.

Specified by:
getFieldPoint in interface GameField
Parameters:
x - X point coordinate.
y - y point coordinate.
Returns:
Field point at given coordinates.
See Also:
GameField.getFieldPoint(int, int)

getMaximumXIndex

public int getMaximumXIndex()
Description copied from interface: GameField
Returns maximum X index.

Specified by:
getMaximumXIndex in interface GameField
Returns:
Maximum X index
See Also:
GameField.getMaximumXIndex()

getMaximumYIndex

public int getMaximumYIndex()
Description copied from interface: GameField
Returns maximum Y index.

Specified by:
getMaximumYIndex in interface GameField
Returns:
Maximum Y index
See Also:
GameField.getMaximumYIndex()


Copyright © 2001-2004 MoMaT & MWe Team. All Rights Reserved.