JSettlers v1.0.6 API
Built ${date}

soc.game
Class SOCBoard

java.lang.Object
  extended bysoc.game.SOCBoard
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class SOCBoard
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This is a representation of the board in Settlers of Catan.

Author:
Robert S Thomas
See Also:
Serialized Form

Field Summary
static int CLAY_HEX
           
static int CLAY_PORT
           
static int CLAY_PORT_HEX
           
static int DESERT_HEX
           
static int MAXEDGE
          largest value for an edge
static int MAXHEX
          largest value for a hex
static int MAXNODE
          largest value for a node
static int MAXNODEPLUSONE
          largest value for a node plus one
static int MINEDGE
          smallest value for an edge
static int MINHEX
          smallest value for a hex
static int MINNODE
          smallest value for a node
static int MISC_PORT
           
static int MISC_PORT_HEX
           
protected  java.util.Hashtable nodesOnBoard
          a list of nodes on the board
static int ORE_HEX
           
static int ORE_PORT
           
static int ORE_PORT_HEX
           
static int SHEEP_HEX
           
static int SHEEP_PORT
           
static int SHEEP_PORT_HEX
           
static int WATER_HEX
           
static int WHEAT_HEX
           
static int WHEAT_PORT
           
static int WHEAT_PORT_HEX
           
static int WOOD_HEX
           
static int WOOD_PORT
           
static int WOOD_PORT_HEX
           
 
Constructor Summary
SOCBoard()
          Create a new Settlers of Catan Board
 
Method Summary
 java.lang.String edgeCoordToString(int edge)
           
static java.util.Vector getAdjacentEdgesToEdge(int coord)
           
static java.util.Vector getAdjacentEdgesToNode(int coord)
           
static java.util.Vector getAdjacentHexesToNode(int coord)
           
static java.util.Vector getAdjacentNodesToEdge(int coord)
           
static java.util.Vector getAdjacentNodesToNode(int coord)
           
 java.util.Vector getCities()
          get the list of cities
 int[] getHexLayout()
           
 int getHexTypeFromCoord(int hex)
          Given a hex coordinate, return the type of hex
 int getHexTypeFromNumber(int hex)
          Given a hex number, return the type of hex
 int[] getNumberLayout()
           
 int getNumberOnHexFromCoord(int hex)
          Given a hex coordinate, return the number on that hex
 int getNumberOnHexFromNumber(int hex)
          Given a hex number, return the number on that hex
 java.util.Vector getPieces()
          get the list of pieces on the board
 java.util.Vector getPortCoordinates(int portType)
           
 int getPortTypeFromHex(int hex)
           
 java.util.Vector getRoads()
          get the list of roads
 int getRobberHex()
           
 java.util.Vector getSettlements()
          get the list of settlements
 boolean isNodeOnBoard(int node)
           
 void makeNewBoard()
          Shuffle the hex tiles and layout a board
 java.lang.String nodeCoordToString(int node)
           
 void putPiece(SOCPlayingPiece pp)
          put a piece on the board
 void removePiece(SOCPlayingPiece piece)
          remove a piece from the board
 void setHexLayout(int[] hl)
          set the hexLayout
 void setNumberLayout(int[] nl)
          set the number layout
 void setRobberHex(int rh)
          set where the robber is
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESERT_HEX

public static final int DESERT_HEX
See Also:
Constant Field Values

CLAY_HEX

public static final int CLAY_HEX
See Also:
Constant Field Values

ORE_HEX

public static final int ORE_HEX
See Also:
Constant Field Values

SHEEP_HEX

public static final int SHEEP_HEX
See Also:
Constant Field Values

WHEAT_HEX

public static final int WHEAT_HEX
See Also:
Constant Field Values

WOOD_HEX

public static final int WOOD_HEX
See Also:
Constant Field Values

WATER_HEX

public static final int WATER_HEX
See Also:
Constant Field Values

MISC_PORT_HEX

public static final int MISC_PORT_HEX
See Also:
Constant Field Values

CLAY_PORT_HEX

public static final int CLAY_PORT_HEX
See Also:
Constant Field Values

ORE_PORT_HEX

public static final int ORE_PORT_HEX
See Also:
Constant Field Values

SHEEP_PORT_HEX

public static final int SHEEP_PORT_HEX
See Also:
Constant Field Values

WHEAT_PORT_HEX

public static final int WHEAT_PORT_HEX
See Also:
Constant Field Values

WOOD_PORT_HEX

public static final int WOOD_PORT_HEX
See Also:
Constant Field Values

MISC_PORT

public static final int MISC_PORT
See Also:
Constant Field Values

CLAY_PORT

public static final int CLAY_PORT
See Also:
Constant Field Values

ORE_PORT

public static final int ORE_PORT
See Also:
Constant Field Values

SHEEP_PORT

public static final int SHEEP_PORT
See Also:
Constant Field Values

WHEAT_PORT

public static final int WHEAT_PORT
See Also:
Constant Field Values

WOOD_PORT

public static final int WOOD_PORT
See Also:
Constant Field Values

MAXHEX

public static final int MAXHEX
largest value for a hex

See Also:
Constant Field Values

MINHEX

public static final int MINHEX
smallest value for a hex

See Also:
Constant Field Values

MAXEDGE

public static final int MAXEDGE
largest value for an edge

See Also:
Constant Field Values

MINEDGE

public static final int MINEDGE
smallest value for an edge

See Also:
Constant Field Values

MAXNODE

public static final int MAXNODE
largest value for a node

See Also:
Constant Field Values

MINNODE

public static final int MINNODE
smallest value for a node

See Also:
Constant Field Values

MAXNODEPLUSONE

public static final int MAXNODEPLUSONE
largest value for a node plus one

See Also:
Constant Field Values

nodesOnBoard

protected java.util.Hashtable nodesOnBoard
a list of nodes on the board

Constructor Detail

SOCBoard

public SOCBoard()
Create a new Settlers of Catan Board

Method Detail

makeNewBoard

public void makeNewBoard()
Shuffle the hex tiles and layout a board


getHexLayout

public int[] getHexLayout()
Returns:
the hex layout

getNumberLayout

public int[] getNumberLayout()
Returns:
the number layout

getRobberHex

public int getRobberHex()
Returns:
where the robber is

setHexLayout

public void setHexLayout(int[] hl)
set the hexLayout

Parameters:
hl - the hex layout

getPortTypeFromHex

public int getPortTypeFromHex(int hex)
Parameters:
hex - the hex type
Returns:
the type of port given a hex type

setNumberLayout

public void setNumberLayout(int[] nl)
set the number layout

Parameters:
nl - the number layout

setRobberHex

public void setRobberHex(int rh)
set where the robber is

Parameters:
rh - the robber hex

getPortCoordinates

public java.util.Vector getPortCoordinates(int portType)
Parameters:
portType - the type of port
Returns:
the list of coordinates for a type of port

getNumberOnHexFromCoord

public int getNumberOnHexFromCoord(int hex)
Given a hex coordinate, return the number on that hex

Parameters:
hex - the coordinates for a hex
Returns:
the number on that hex

getNumberOnHexFromNumber

public int getNumberOnHexFromNumber(int hex)
Given a hex number, return the number on that hex

Parameters:
hex - the number of a hex
Returns:
the number on that hex

getHexTypeFromCoord

public int getHexTypeFromCoord(int hex)
Given a hex coordinate, return the type of hex

Parameters:
hex - the coordinates for a hex
Returns:
the type of hex

getHexTypeFromNumber

public int getHexTypeFromNumber(int hex)
Given a hex number, return the type of hex

Parameters:
hex - the number of a hex
Returns:
the type of hex

putPiece

public void putPiece(SOCPlayingPiece pp)
put a piece on the board


removePiece

public void removePiece(SOCPlayingPiece piece)
remove a piece from the board


getPieces

public java.util.Vector getPieces()
get the list of pieces on the board


getRoads

public java.util.Vector getRoads()
get the list of roads


getSettlements

public java.util.Vector getSettlements()
get the list of settlements


getCities

public java.util.Vector getCities()
get the list of cities


getAdjacentNodesToEdge

public static java.util.Vector getAdjacentNodesToEdge(int coord)
Returns:
the nodes that touch this edge

getAdjacentEdgesToEdge

public static java.util.Vector getAdjacentEdgesToEdge(int coord)
Returns:
the adjacent edges to this edge

getAdjacentHexesToNode

public static java.util.Vector getAdjacentHexesToNode(int coord)
Returns:
the hexes touching this node

getAdjacentEdgesToNode

public static java.util.Vector getAdjacentEdgesToNode(int coord)
Returns:
the edges touching this node

getAdjacentNodesToNode

public static java.util.Vector getAdjacentNodesToNode(int coord)
Returns:
the EDGEs adjacent to this node

isNodeOnBoard

public boolean isNodeOnBoard(int node)
Returns:
true if the node is on the board

nodeCoordToString

public java.lang.String nodeCoordToString(int node)
Returns:
a string representation of a node coordinate

edgeCoordToString

public java.lang.String edgeCoordToString(int edge)
Returns:
a string representation of an edge coordinate

JSettlers v1.0.6 API
Built ${date}