com.ibm.ruler
Class World

java.lang.Object
  |
  +--com.ibm.ruler.World

public class World
extends java.lang.Object

This class allows you to get information about the CodeRuler environment.


Field Summary
static int HEIGHT
          The height of the "world" in units.
static int MAX_TURNS
          The maximum number of turns in each match.
static int WIDTH
          The width of the "world" in units.
 
Method Summary
static int getCurrentTurn()
          Returns the number of turns that have occurred so far during this match.
static IRuler getLandOwner(int x, int y)
          Returns the ruler that has claimed the land at the given position, or null if the position is out of bounds or no ruler has claimed the land.
static IObject getObjectAt(int x, int y)
          Returns the peasant, knight, or castle that is at the given location, or null if there is nothing at the given location or it is out of bounds.
static ICastle[] getOtherCastles()
          Returns an array of all the castles from other rulers that are currently in this match.
static IKnight[] getOtherKnights()
          Returns an array of all the knights from other rulers that are currently in this match.
static IPeasant[] getOtherPeasants()
          Returns an array of all the peasants from other rulers that are currently in this match.
static IRuler[] getOtherRulers()
          Returns an array of all the other rulers that you are currently competing against in this match.
static java.awt.Point getPositionAfterMove(int x, int y, int direction)
          Returns the coordinates of the square in the given direction from the given point.

Method Detail

getCurrentTurn

public static int getCurrentTurn()
Returns the number of turns that have occurred so far during this match.

Returns:
int

getLandOwner

public static IRuler getLandOwner(int x,
                                  int y)
Returns the ruler that has claimed the land at the given position, or null if the position is out of bounds or no ruler has claimed the land.

Parameters:
x - - An x position
y - - A y position
Returns:
com.ibm.ruler.IRuler

getObjectAt

public static IObject getObjectAt(int x,
                                  int y)
Returns the peasant, knight, or castle that is at the given location, or null if there is nothing at the given location or it is out of bounds.

Parameters:
x - - An x position
y - - A y position
Returns:
com.ibm.ruler.IObject

getOtherCastles

public static ICastle[] getOtherCastles()
Returns an array of all the castles from other rulers that are currently in this match. This array will not include your own castles, will always return the castles in the same order, and will return an empty array if there are no other castles.

Returns:
com.ibm.ruler.ICastle[]

getOtherKnights

public static IKnight[] getOtherKnights()
Returns an array of all the knights from other rulers that are currently in this match. This array will not include your own knights, will always return the knights in the same order, and will return an empty array if there are no other knights.

Returns:
com.ibm.ruler.IKnight[]

getOtherPeasants

public static IPeasant[] getOtherPeasants()
Returns an array of all the peasants from other rulers that are currently in this match. This array will not include your own peasants, will always return the peasants in the same order, and will return an empty array if there are no other peasants.

Returns:
com.ibm.ruler.IPeasant[]

getOtherRulers

public static IRuler[] getOtherRulers()
Returns an array of all the other rulers that you are currently competing against in this match. This array will not include your own ruler, and will always return the rulers in the same order.

Returns:
com.ibm.ruler.IRuler[]

getPositionAfterMove

public static java.awt.Point getPositionAfterMove(int x,
                                                  int y,
                                                  int direction)
Returns the coordinates of the square in the given direction from the given point. Returns null if the square is out of bounds.

Parameters:
x - - An x position
y - - A y position
direction - - The direction in which to return the position
Returns:
java.awt.Point