soc.game
Class SOCBoardLarge

java.lang.Object
  extended by soc.game.SOCBoard
      extended by soc.game.SOCBoardLarge
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
SOCBoardLargeAtServer

public class SOCBoardLarge
extends SOCBoard

Sea board layout: A representation of a larger (up to 127 x 127 hexes) JSettlers board, with an arbitrary mix of land and water tiles. Implements SOCBoard.BOARD_ENCODING_LARGE. Activated with SOCGameOption "SBL". For the board layout geometry, see the "Coordinate System" section here.

A SOCGame uses this board; the board is not given a reference to the game, to enforce layering and keep the board logic simple. Game rules should be enforced at the game, not the board. Calling board methods won't change the game state.

To create a new board, use subclass soc.server.SOCBoardLargeAtServer. Game boards are initially all water. The layout contents are set up later by calling SOCBoardLargeAtServer.makeNewBoard(Map) when the game is about to begin, then sent to the clients over the network. The client calls methods such as setLandHexLayout(int[]), setPortsLayout(int[]), SOCGame.putPiece(SOCPlayingPiece), and setLegalAndPotentialSettlements(Collection, int, HashSet[]) with data from the server.

See SOCBoardLargeAtServer's class javadoc, and its makeNewBoard(Map) javadoc, for more details on layout creation.

On this large sea board, there can optionally be multiple "land areas" (groups of islands, or subsets of islands), if getLandAreasLegalNodes() != null. Land areas are groups of nodes on land; call getNodeLandArea(int) to find a node's land area number. The starting land area is getStartingLandArea(), if players must start in a certain area. In some game scenarios, players and the robber can be excluded from placing in some land areas.

Server and client must be 2.0.00 or newer (VERSION_FOR_ENCODING_LARGE). The board layout is sent using getLandHexLayout() and SOCBoard.getPortsLayout(), followed by the robber hex and pirate hex (if they're > 0), and then (a separate message) the legal settlement/city nodes and land areas.

Ship pieces extend the SOCRoad class; road-related getters/setters will work on them, but check SOCRoad.isRoadNotShip() to differentiate. You cannot place both a road and a ship on the same coastal edge coordinate.

Some scenarios may add other "layout parts" related to their scenario board layout. For example, scenario _SC_PIRI adds "PP" for the path the pirate fleet follows. See getAddedLayoutPart(String), setAddedLayoutPart(String, int[]). The layout part keys are documented at SOCBoardLayout2.

Geometry/Navigation methods:


 Adjacent to a:
Get the: Hex Edge Node
Hex getAdjacentHexesToHex(int, boolean)
isHexAdjacentToHex(int, int)
getAdjacentHexToEdge(int, int)
getAdjacentHexesToEdge_arr(int)
getAdjacentHexesToEdgeEnds(int)
getAdjacentHexesToNode(int)
Edge getAdjacentEdgesToHex(int)
isEdgeAdjacentToHex(int, int)
getAdjacentEdgesToEdge(int) getAdjacentEdgeToNode(int, int)
getAdjacentEdgeToNode2Away(int, int)
SOCBoard.getAdjacentEdgesToNode(int)
SOCBoard.getAdjacentEdgesToNode_arr(int)
getAdjacentEdgesToNode_coastal(int)
getEdgeBetweenAdjacentNodes(int, int)
isEdgeAdjacentToNode(int, int)
Node getAdjacentNodeToHex(int, int)
getAdjacentNodesToHex(int)
getAdjacentNodeToEdge(int, int)
getAdjacentNodesToEdge(int)
getAdjacentNodesToEdge_arr(int)
SOCBoard.getAdjacentNodeFarEndOfEdge(int, int)
getNodeBetweenAdjacentEdges(int, int)
getAdjacentNodeToNode(int, int)
getAdjacentNodeToNode2Away(int, int)
SOCBoard.getAdjacentNodesToNode(int)
SOCBoard.getAdjacentNodesToNode_arr(int)
SOCBoard.isNodeAdjacentToNode(int, int)
isNode2AwayFromNode(int, int)
Other methods: Hex Edge Node
  isHexInBounds(int, int)
isHexOnLand(int)
isHexOnWater(int)
isHexCoastline(int)
getNumberOnHexFromCoord(int)
getNumberOnHexFromNumber(int)
getHexTypeFromCoord(int)
getHexTypeFromNumber(int)
SOCBoard.getRobberHex()
getPirateHex()
SOCBoard.getPreviousRobberHex()
getPreviousPirateHex()
getLandHexLayout()
getLandHexCoords()
getLandHexCoordsSet()
isHexAtBoardMargin(int)
isHexInLandAreas(int, int[])
isEdgeInBounds(int, int)
isEdgeCoastline(int)
SOCBoard.roadAtEdge(int)
getPortsEdges()
isNodeInBounds(int, int)
SOCBoard.isNodeOnLand(int)
isNodeCoastline(int)
SOCBoard.settlementAtNode(int)
getPortEdgeFromNode(int)
SOCBoard.getPortTypeFromNodeCoord(int)
getNodeLandArea(int)
isNodeInLandAreas(int, int[])
getLandAreasLegalNodes()
Some of these geometry methods are specific to SOCBoardLarge and don't appear in the parent SOCBoard.

Coordinate System:

See src/docs/hexcoord-sea.png

Unlike earlier encodings, here the "hex number" ("ID") is not an index into a dense array of land hexes. Thus it's not efficient to iterate through all hex numbers.
Instead: Hex ID = (r << 8) | c // 2 bytes: 0xRRCC

The coordinate system is a square grid of rows and columns, different from previous encodings:

Hexes (represented as coordinate of their centers), nodes (corners of hexes; where settlements/cities are placed), and edges (between nodes; where roads are placed), share the same grid of coordinates. Each hex is 2 units wide and 2 tall, with vertical sides (west,edge edges) and sloped tops and bottoms (NW, NE, SW, SE edges).

Coordinates start at the upper-left and continue to the right and down. The first few rows of hexes are:

    (1,2)  (1,4)  (1,6) ..
 (3,1) (3,3)  (3,5)  (3,7) ..
    (5,2)  (5,4)  (5,6) ..
 (7,1) (7,3)  (7,5)  (7,7) ..
    (9,2)  (9,4)  (9,6) .. 
All water and land hexes are within the coordinates. Rows increase going north to south, Columns increase west to east.

Vertical edge coordinates are at the edge's center (between two hex coordinates, which are to the west and east of the edge); vertical edge row coordinates are odd like hexes. Otherwise, edges get the coordinate of the node at their western end.

The first few rows of nodes are:

       (0,2)  (0,4)  (0,6) ..
   (0,1)  (0,3)  (0,5) ..

   (2,1)  (2,3)  (2,5) ..
(2,0)  (2,2)  (2,4)  (2,6) ..

(4,0)  (4,2)  (4,4)  (4,6) ..
   (4,1)  (4,3)  (4,5) ..

   (6,1)  (6,3)  (6,5) ..
(6,0)  (6,2)  (6,4)  (6,6) .. 

Since:
2.0.00
Author:
Jeremy D Monin <jeremy@nand.net>
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class soc.game.SOCBoard
SOCBoard.BoardFactory, SOCBoard.DefaultBoardFactory
 
Field Summary
private static int[][] A_EDGE2EDGE
          Used by getAdjacentEdgesToEdge(int).
private static int[][] A_EDGE2HEX
          For getAdjacentEdgesToHex(int), the offset to add to the hex coordinate to get all adjacent edge coords, starting at index 0 at the top (northeastern edge of hex) and going clockwise.
private static int[][] A_HEX2HEX
          For getAdjacentHexesToHex(int, boolean), the offsets to add to the hex row and column to get all adjacent hex coords, starting at index 0 at the northeastern edge of the hex and going clockwise.
private static int[][] A_NODE2HEX
          For getAdjacentNodeToHex(int, int), the offset to add to the hex coordinate to get all adjacent node coords, starting at index 0 at the top (northern corner of hex) and going clockwise.
private  java.util.HashMap<java.lang.String,int[]> addedLayoutParts
          For some scenarios, keyed lists of additional layout parts to add to game layout when sent from server to client.
static int BOARDHEIGHT_LARGE
          Default size of the large board.
static int BOARDWIDTH_LARGE
          Default size of the large board.
protected  int[] cachedGetLandHexCoords
          The set of land hex coordinates within hexLayoutLg, as returned by getLandHexCoords(), or null.
static int FOG_HEX
          Hex type for the Fog Hex, with actual type revealed when roads or ships are placed.
protected  java.util.HashMap<java.lang.Integer,java.lang.Integer> fogHiddenHexes
          Actual hex types and dice numbers hidden under FOG_HEX.
static int GOLD_HEX
          Hex type for the Gold Hex, where the adjacent players choose their resource(s) every roll.
protected  int[][] hexLayoutLg
          Hex layout: water/land resource types.
protected  java.util.HashSet<java.lang.Integer>[] landAreasLegalNodes
          When the board has multiple "land areas" (groups of islands), this array holds each land area's nodes for settlements/cities.
protected  java.util.HashSet<java.lang.Integer> landHexLayout
          The set of land hex coordinates within hexLayoutLg.
protected  java.util.HashSet<java.lang.Integer> legalRoadEdges
          The legal set of land edge coordinates to build roads, based on SOCBoard.nodesOnLand.
protected  java.util.HashSet<java.lang.Integer> legalShipEdges
          The legal set of water/coastline edge coordinates to build ships, based on hexLayoutLg.
protected static int MAX_LAND_HEX_LG
          Maximum land hex type (== FOG_HEX) for this encoding.
protected  int maxPlayers
          Maximum players (4 or 6).
private static int[] NODE_TO_NODE_2_AWAY
          (r,c) Offsets from a node to another node 2 away, Indexed by the facing directions: SOCBoard.FACING_NE is 1, SOCBoard.FACING_E is 2, etc; SOCBoard.FACING_NW is 6.
protected  int[][] numberLayoutLg
          Dice number from hex coordinate.
private  int numCloth
          For some scenarios, how many cloth does the board have in its "general supply"? This supply is used if a village's SOCVillage.takeCloth(int) returns less than the amount needed.
protected  int pirateHex
          the hex coordinate that the pirate is in, or 0; placed in makeNewBoard(Map).
private  int[] playerExcludedLandAreas
          Land area numbers from which the player is excluded and cannot place settlements, or null.
protected  int portsCount
          This board layout's number of ports; 0 if makeNewBoard(Map) hasn't been called yet.
private  int prevPirateHex
          the previous hex coordinate that the pirate is in; 0 unless setPirateHex(rh, true) was called.
private  int[] robberExcludedLandAreas
          Land areas numbers from which the robber is excluded and cannot be placed, or null.
private static long serialVersionUID
          SOCBoardLarge serial, to suppress warning.
static int SPECIAL_EDGE_DEV_CARD
          Special Edge Type code that gives a development card when player reaches a special edge.
static java.lang.String[] SPECIAL_EDGE_LAYOUT_PARTS
          Names of optional Added Layout Parts which contain Special Edges when present, currently "CE" and "VE".
static int SPECIAL_EDGE_SVP
          Special Edge Type code that gives a Special Victory Point when player reaches a special edge.
static int[] SPECIAL_EDGE_TYPES
          Special Edge type codes, such as SPECIAL_EDGE_DEV_CARD, for all Added Layout Parts which contain Special Edges when present.
private  java.util.HashMap<java.lang.Integer,java.lang.Integer> specialEdges
          Map of special edge coordinates to types.
protected  int startingLandArea
          When players must start the game in a certain land area, the starting land area number; also its index in landAreasLegalNodes, because that set of legal nodes is also the players' potential settlement nodes.
static int VERSION_FOR_ENCODING_LARGE
          This board encoding SOCBoard.BOARD_ENCODING_LARGE was introduced in version 2.0.00 (2000)
protected  java.util.HashMap<java.lang.Integer,SOCVillage> villages
          For some scenarios, villages on the board.
 
Fields inherited from class soc.game.SOCBoard
BOARD_ENCODING_6PLAYER, BOARD_ENCODING_LARGE, BOARD_ENCODING_ORIGINAL, boardEncodingFormat, boardHeight, boardWidth, cities, CLAY_HEX, CLAY_PORT, CLAY_PORT_HEX, DESERT_HEX, FACING_E, FACING_NE, FACING_NW, FACING_SE, FACING_SW, FACING_W, HEXCOORDS_LAND_V1, HEXCOORDS_LAND_V2, makeNewBoard_diceNums_v1, makeNewBoard_diceNums_v2, makeNewBoard_landHexTypes_v1, makeNewBoard_landHexTypes_v2, MAX_BOARD_ENCODING, max_robber_hextype, MAXEDGE_V1, MAXEDGE_V2, MAXHEX, MINEDGE_V1, MINEDGE_V2, MINHEX, MINNODE_V1, MINNODE_V2, MISC_PORT, MISC_PORT_HEX, nodeIDtoPortType, nodesOnLand, ORE_HEX, ORE_PORT, ORE_PORT_HEX, ports, PORTS_TYPE_V1, PORTS_TYPE_V2, portsLayout, rand, roads, settlements, SHEEP_HEX, SHEEP_PORT, SHEEP_PORT_HEX, WATER_HEX, WHEAT_HEX, WHEAT_PORT, WHEAT_PORT_HEX, WOOD_HEX, WOOD_PORT, WOOD_PORT_HEX
 
Constructor Summary
SOCBoardLarge(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers)
          Create a new Settlers of Catan Board, with the v3 encoding.
SOCBoardLarge(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers, IntPair boardHeightWidth)
          Create a new Settlers of Catan Board, with the v3 encoding and a certain size.
 
Method Summary
 void addLegalNodes(int[] nodes, int lan)
          Add nodes to Nodes On Land and optionally to a a Land Area's legal nodes.
 void addLoneLegalSettlements(SOCGame ga, int[] ls)
          Add one legal settlement location to each player.
 boolean canRemovePort(int edge)
          For scenario option _SC_FTRI, can a "gift" port at this edge be removed for placement elsewhere?
 void clearSpecialEdges(int seType)
          Clear all edges marked as one special type.
 int[] distributeClothFromRoll(SOCGame game, int dice)
          Game action: Distribute cloth to players on a dice roll.
 java.lang.Integer drawItemFromStack()
          If this scenario has dev cards or items waiting to be claimed by any player, draw the next item from that stack.
 java.lang.String edgeCoordToString(int edge)
          Get the dice roll numbers for hexes on either side of this edge.
 int[] getAddedLayoutPart(java.lang.String key)
          Get one "added layout part" by its key name.
 java.util.HashMap<java.lang.String,int[]> getAddedLayoutParts()
          Get the keyed lists of additional layout parts to add to game layout, used only in some scenarios.
 java.util.Vector<java.lang.Integer> getAdjacentEdgesToEdge(int coord)
          Get the edge coordinates of the 2 to 4 edges adjacent to this edge.
 int[] getAdjacentEdgesToHex(int hexCoord)
          The edge coordinates adjacent to this hex in all 6 directions.
 java.util.List<java.lang.Integer> getAdjacentEdgesToNode_coastal(int node)
          Get the coastal (land+water) edges adjacent to this node, if any.
 int getAdjacentEdgeToNode(int nodeCoord, int nodeDir)
          Given a node, get the valid adjacent edge in a given direction, if any.
 int getAdjacentEdgeToNode2Away(int node, int node2away)
          Given an initial node, and a second node 2 nodes away, calculate the road/edge coordinate (adjacent to the initial node) going towards the second node.
private  void getAdjacentHexes2Hex_AddIfOK(java.util.Vector<java.lang.Integer> addTo, boolean includeWater, int r, int c)
          Check one possible coordinate for getAdjacentHexesToHex.
 int[] getAdjacentHexesToEdge_arr(int edgeCoord)
          The valid hex or two hexes touching an edge along its length.
 int[] getAdjacentHexesToEdgeEnds(int edgeCoord)
          The valid hex or two hexes past each end of an edge.
 java.util.Vector<java.lang.Integer> getAdjacentHexesToHex(int hexCoord, boolean includeWater)
          Make a list of all valid hex coordinates (or, only land) adjacent to this hex.
 java.util.Vector<java.lang.Integer> getAdjacentHexesToNode(int nodeCoord)
          Get the coordinates of the hexes adjacent to this node.
 int getAdjacentHexToEdge(int edgeCoord, int facing)
          The hex touching an edge in a given direction, either along its length or at one end node.
 int[] getAdjacentNodesToEdge_arr(int coord)
          Adjacent node coordinates to an edge (that is, the nodes that are the two ends of the edge).
 java.util.Vector<java.lang.Integer> getAdjacentNodesToEdge(int coord)
          Adjacent node coordinates to an edge (that is, the nodes that are the two ends of the edge).
 int[] getAdjacentNodesToHex(int hexCoord)
          The node coordinates adjacent to this hex in all 6 directions.
 int getAdjacentNodeToEdge(int edgeCoord, int facing)
          The node at the end of an edge in a given direction.
 int getAdjacentNodeToHex(int hexCoord, int dir)
          The node coordinate adjacent to this hex in a given direction.
 int getAdjacentNodeToNode(int nodeCoord, int nodeDir)
          Given a node, get the valid adjacent node in a given direction, if any.
 int getAdjacentNodeToNode2Away(int nodeCoord, int facing)
          Get the coordinate of another node 2 away, based on a starting node.
private static IntPair getBoardSize(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers)
          Get the board size for client's constructor: Default size BOARDHEIGHT_LARGE by BOARDWIDTH_LARGE, unless gameOpts contains "_BHW" Board Height and Width.
 int getCloth()
          Get how many cloth does the board have in its "general supply" (used in some scenarios).
 int getEdgeBetweenAdjacentNodes(int nodeA, int nodeB)
          Given a pair of adjacent node coordinates, get the edge coordinate that connects them.
 int[] getHexLayout()
          Deprecated. 
 int getHexNumFromCoord(int hexCoord)
          Deprecated. 
 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.
 java.util.HashSet<java.lang.Integer>[] getLandAreasLegalNodes()
          Get the land areas' nodes, if multiple "land areas" are used.
 int[] getLandHexCoords()
          The hex coordinates of all land hexes.
 java.util.HashSet<java.lang.Integer> getLandHexCoordsSet()
          The hex coordinates of all land hexes.
 int[] getLandHexLayout()
          Get the land hex layout, for sending from server to client.
 java.util.HashSet<java.lang.Integer> getLegalAndPotentialSettlements()
          Get the legal and potential settlements, after makeNewBoard(Map).
 int getNodeBetweenAdjacentEdges(int edgeA, int edgeB)
          Given a pair of adjacent edge coordinates, get the node coordinate that connects them.
 int getNodeLandArea(int nodeCoord)
          Get a node's Land Area number, if applicable.
 int[] getNumberLayout()
          Deprecated. 
 int getNumberOnHexFromCoord(int hex)
          Given a hex coordinate, return the dice-roll number on that hex
 int getNumberOnHexFromNumber(int hex)
          Given a hex coordinate / hex number, return the (dice-roll) number on that hex
 int getPirateHex()
           
 int[] getPlayerExcludedLandAreas()
          Get the land area numbers, if any, from which all players are excluded and cannot place settlements.
 int getPortEdgeFromNode(int node)
          Find the port edge, if any, that touches this node.
 int getPortFacingFromEdge(int edge)
          Given a coastal edge, find the "port facing" direction (towards land) for that edge.
 int getPortsCount()
          Get the number of ports on this board.
 int[] getPortsEdges()
          Each port's edge coordinate.
 int[] getPortsFacing()
          Each port's facing, such as SOCBoard.FACING_NW.
 int getPreviousPirateHex()
          If the pirate has been moved by calling setPirateHex(int, boolean) where rememberPrevious == true, get the previous coordinate of the pirate.
 int[] getRobberExcludedLandAreas()
          Get the land area numbers, if any, from which the robber is excluded and cannot be placed.
 java.util.Iterator<java.util.Map.Entry<java.lang.Integer,java.lang.Integer>> getSpecialEdges()
          Get all Special Edge coordiates and their types.
 int getSpecialEdgeType(int edge)
          Get this edge's Special Edge Type, if any.
 int getStartingLandArea()
          Get the starting land area, if multiple "land areas" are used and the players must start the game in a certain land area.
 int[] getVillageAndClothLayout()
          Get the village and cloth layout, for sending from server to client for scenario game option SOCGameOption.K_SC_CLVI.
 SOCVillage getVillageAtNode(int nodeCoord)
          If there's a village placed at this node during board setup, find it.
 java.util.HashMap<java.lang.Integer,SOCVillage> getVillages()
          Get the SOCVillages on the board, for scenario game option SOCGameOption.K_SC_CLVI.
 boolean hasSpecialEdges()
          Does this board contain any Special Edges?
protected  void initLegalRoadsFromLandNodes()
          Once the legal settlement/city nodes (SOCBoard.nodesOnLand) are established from land hexes, fill legalRoadEdges.
protected  void initLegalShipEdges()
          Once the legal settlement/city nodes (SOCBoard.nodesOnLand) are established from land hexes, fill legalShipEdges.
(package private)  java.util.HashSet<java.lang.Integer> initPlayerLegalRoads()
          Create and initialize a SOCPlayer's legalRoads set.
(package private)  java.util.HashSet<java.lang.Integer> initPlayerLegalShips()
          Create and initialize a SOCPlayer's legalShips set.
 boolean isEdgeAdjacentToHex(int edgeCoord, int hexCoord)
          Is this edge adjacent to this hex? (Is it one of the 6 sides of the hex?)
 boolean isEdgeAdjacentToNode(int nodeCoord, int edgeCoord)
          Determine if this node and edge are adjacent.
 boolean isEdgeCoastline(int edge)
          Is this edge along the coastline (land/water border)? Off the edge of the board is considered water.
 boolean isEdgeInBounds(int r, int c)
          Is this an edge coordinate within the board's boundaries, not overlapping or off the side of the board? TODO description...
 boolean isHexAdjacentToHex(int hex1Coord, int hex2Coord)
          Are these hexes adjacent?
 boolean isHexAtBoardMargin(int hexCoord)
          Is this hex coordinate at the board's boundaries, with one or more adjacent hexes off the side of the board?
 boolean isHexCoastline(int hexCoord)
          Is this land hex along the coastline (land/water border)? Off the edge of the board is considered water.
 boolean isHexInBounds(int r, int c)
          Is this hex coordinate within the board's boundaries, not off the side of the board?
 boolean isHexInLandAreas(int hexCoord, int[] las)
          Is this hex's land area in this list of land areas?
 boolean isHexOnLand(int hexCoord)
          Is this the coordinate of a land hex (not water)?
 boolean isHexOnWater(int hexCoord)
          Is this the coordinate of a water hex (not land)?
 boolean isNode2AwayFromNode(int n1, int n2)
          Determine if these 2 nodes are 2 nodes apart on the board, by the node coordinate arithmetic.
 boolean isNodeCoastline(int node)
          Is this node along the coastline (land/water border)? Off the edge of the board is considered water.
 boolean isNodeInBounds(int r, int c)
          Is this an edge coordinate within the board's boundaries, not overlapping or off the side of the board? TODO description...
 boolean isNodeInLandAreas(int nodeCoord, int[] las)
          Is this node's land area in this list of land areas?
 void makeNewBoard(java.util.Map<java.lang.String,SOCGameOption> opts)
          Shuffle the hex tiles and layout a board.
 int movePirateHexAlongPath(int numSteps)
          For game scenario option _SC_PIRI, move the pirate fleet's position along its path.
(package private)  void placePort(int ptype, int edge)
          For scenario option _SC_FTRI, place a "gift" port at this edge.
 void putPiece(SOCPlayingPiece pp)
          Put a piece on the board.
 int removePort(int edge)
          For scenario option _SC_FTRI, remove a "gift" port at this edge for placement elsewhere.
(package private)  void revealFogHiddenHex(int hexCoord, int hexType, int diceNum)
          Reveal one land or water hex hidden by fog (call from SOCGame).
 int revealFogHiddenHexPrep(int hexCoord)
          Prepare to reveal one land or water hex hidden by fog (server-side call).
 void setAddedLayoutPart(java.lang.String key, int[] v)
          Set one "added layout part" by its key name.
 void setAddedLayoutParts(java.util.HashMap<java.lang.String,int[]> adds)
          Set all the "added layout parts", for use at client.
 void setCloth(int numCloth)
          Set how many cloth the board currently has in its "general supply".
 void setHexLayout(int[] hl)
          Deprecated. 
 void setLandHexLayout(int[] lh)
          Set the land hex layout, sent from server to client.
 void setLegalAndPotentialSettlements(java.util.Collection<java.lang.Integer> psNodes, int sla, java.util.HashSet<java.lang.Integer>[] lan)
          Set the legal and potential settlements, and calculate the Nodes On Land, legal roads and ship edges.
 void setNumberLayout(int[] nl)
          Deprecated. 
 void setPirateHex(int ph, boolean rememberPrevious)
          Set where the pirate is, or take the pirate off the board.
 void setPlayerExcludedLandAreas(int[] px)
          Set or clear the land area numbers from which all players are excluded and cannot place settlements.
 void setPortsLayout(int[] portTypesAndInfo)
          Set the port information at the client, sent from the server from SOCBoard.getPortsLayout().
 void setRobberExcludedLandAreas(int[] rx)
          Set or clear the land area numbers from which the robber is excluded and cannot be placed.
 void setSpecialEdge(int edge, int seType)
          Set an edge as a Special Edge, or clear that status and make it a normal edge.
 void setSpecialEdges(int[] edges, int seType)
          Set a list of edges as a certain type of special edge.
 void setVillageAndClothLayout(int[] villageNodesAndDice)
          For makeNewBoard(Map), with the Cloth Village scenario, create SOCVillages at these node locations.
 int takeCloth(int numTake)
          Take this many cloth, if available, from the board's "general supply".
 
Methods inherited from class soc.game.SOCBoard
getAdjacentEdgesToNode_arr, getAdjacentEdgesToNode, getAdjacentNodeFarEndOfEdge, getAdjacentNodesToNode_arr, getAdjacentNodesToNode, getBoardEncodingFormat, getBoardHeight, getBoardWidth, getCities, getPortCoordinates, getPortDescForType, getPortsLayout, getPortTypeFromNodeCoord, getPreviousRobberHex, getRoads, getRobberHex, getSettlements, initPlayerLegalAndPotentialSettlements, isNodeAdjacentToNode, isNodeOnLand, makeNewBoard_checkLandHexResourceClumps, makeNewBoard_shufflePorts, nodeCoordToString, placePort, removePiece, roadAtEdge, setBoardBounds, setBoardEncodingFormat, setRobberHex, settlementAtNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
SOCBoardLarge serial, to suppress warning. SOCBoardLarge isn't sent over the network as a serialized object.

See Also:
Constant Field Values

VERSION_FOR_ENCODING_LARGE

public static final int VERSION_FOR_ENCODING_LARGE
This board encoding SOCBoard.BOARD_ENCODING_LARGE was introduced in version 2.0.00 (2000)

See Also:
Constant Field Values

GOLD_HEX

public static final int GOLD_HEX
Hex type for the Gold Hex, where the adjacent players choose their resource(s) every roll.

There is no 2-for-1 port (unlike SOCBoard.SHEEP_PORT, SOCBoard.WOOD_PORT, etc) for this hex type. Gold is not a resource.

The numeric value (7) for GOLD_HEX is the same as the v1/v2 encoding's SOCBoard.MISC_PORT_HEX, but the ports aren't encoded as hexes for this encoding, so there is no ambiguity as long as callers of getHexTypeFromCoord(int) check the board encoding format.

See Also:
Constant Field Values

FOG_HEX

public static final int FOG_HEX
Hex type for the Fog Hex, with actual type revealed when roads or ships are placed. Used with some scenarios (see SOCGameOption.K_SC_FOG). Bots should treat this as DESERT_HEX until revealed.

To simplify the bot, client, and network, hexes can be hidden only at the server during makeNewBoard(Map) before the board layout is finished and sent to the client.

The numeric value (8) for FOG_HEX is the same as the v1/v2 encoding's SOCBoard.CLAY_PORT_HEX, but the ports aren't encoded as hexes for this encoding, so there is no ambiguity as long as callers of getHexTypeFromCoord(int) check the board encoding format.

See Also:
revealFogHiddenHexPrep(int), revealFogHiddenHex(int, int, int), Constant Field Values

MAX_LAND_HEX_LG

protected static final int MAX_LAND_HEX_LG
Maximum land hex type (== FOG_HEX) for this encoding. If you add a hex type, search for this and for FOG_HEX for likely changes. Be sure to also update the client's SOCBoardPanel.loadImages.

See Also:
Constant Field Values

BOARDHEIGHT_LARGE

public static final int BOARDHEIGHT_LARGE
Default size of the large board. Can override in constructor. See getBoardHeight(), getBoardWidth().

See Also:
Constant Field Values

BOARDWIDTH_LARGE

public static final int BOARDWIDTH_LARGE
Default size of the large board. Can override in constructor. See getBoardHeight(), getBoardWidth().

See Also:
Constant Field Values

SPECIAL_EDGE_DEV_CARD

public static final int SPECIAL_EDGE_DEV_CARD
Special Edge Type code that gives a development card when player reaches a special edge. After the player gets their reward, the special edge is cleared, no other player can be rewarded there. These edges are Added Layout Part "CE".

Special Edges:

For some scenarios, some edges have a special purpose or reward. For example, SC_FTRI gives dev cards or special victory points when a ship reaches one.

Some related methods:

The Special Edge Types are constants such as SPECIAL_EDGE_DEV_CARD or SPECIAL_EDGE_SVP used by game and board logic. Game events or SOCScenarioPlayerEvents can happen when something occurs at such an edge. Often these will clear the edge's type, it will no longer be special.

During board setup, lists of edges of a special type are sent with the board layout as Added Layout Parts such as "CE" and "VE" used with getAddedLayoutPart(String). Calls to setAddedLayoutParts(HashMap) or setAddedLayoutPart(String, int[]) add them to the Special Edges mapping if it recognizes the layout part as a special edge type.

During game play, when a Special Edge is set or cleared the server will send a message to the game with the edge coordinate and its new special type code.

If you add a Special Edge Type code, it should probably be added to:

To find where to add the new type, search those for SPECIAL_EDGE_DEV_CARD.

Not many board layouts and scenarios have Special Edges, so usually hasSpecialEdges() == false.

See Also:
Constant Field Values

SPECIAL_EDGE_SVP

public static final int SPECIAL_EDGE_SVP
Special Edge Type code that gives a Special Victory Point when player reaches a special edge. After the player gets their reward, the special edge is cleared, no other player can be rewarded there. These edges are Added Layout Part "VE".

For more information on Special Edges, see SPECIAL_EDGE_DEV_CARD.

See Also:
Constant Field Values

SPECIAL_EDGE_LAYOUT_PARTS

public static final java.lang.String[] SPECIAL_EDGE_LAYOUT_PARTS
Names of optional Added Layout Parts which contain Special Edges when present, currently "CE" and "VE". SPECIAL_EDGE_TYPES[i] is the Special Edge type for SPECIAL_EDGE_LAYOUT_PARTS[i], edge coordinates of that special type are getAddedLayoutPart (SPECIAL_EDGE_LAYOUT_PARTS[i]).

For more information on Special Edges, see SPECIAL_EDGE_DEV_CARD.


SPECIAL_EDGE_TYPES

public static final int[] SPECIAL_EDGE_TYPES
Special Edge type codes, such as SPECIAL_EDGE_DEV_CARD, for all Added Layout Parts which contain Special Edges when present. SPECIAL_EDGE_TYPES[i] is the Special Edge type code for SPECIAL_EDGE_LAYOUT_PARTS[i].


A_HEX2HEX

private static final int[][] A_HEX2HEX
For getAdjacentHexesToHex(int, boolean), the offsets to add to the hex row and column to get all adjacent hex coords, starting at index 0 at the northeastern edge of the hex and going clockwise.

Coordinate offsets - adjacent hexes to hex:

   (-2,-1) (-2,+1)

 (0,-2)   x   (0,+2)

   (+2,-1) (+2,+1)  

For each direction, array of delta to the row & column. (Not to the encoded coordinate.) Indexed by the facing direction - 1: FACING_NE is 1, FACING_E is 2, etc; FACING_NW is 6. Index here for FACING_NE is 0, FACING_NW is 5.


A_NODE2HEX

private static final int[][] A_NODE2HEX
For getAdjacentNodeToHex(int, int), the offset to add to the hex coordinate to get all adjacent node coords, starting at index 0 at the top (northern corner of hex) and going clockwise. Because we're looking at nodes and not edges (corners, not sides, of the hex), these are offset from the set of "facing" directions by 30 degrees.

For each direction, array of adds to the coordinate to change the row & column. The row delta in hex is +-0xRR00, the column is small (+-1) so doesn't need hex format.


A_EDGE2HEX

private static final int[][] A_EDGE2HEX
For getAdjacentEdgesToHex(int), the offset to add to the hex coordinate to get all adjacent edge coords, starting at index 0 at the top (northeastern edge of hex) and going clockwise.

For each direction, array of adds to the coordinate to change the row & column. The row delta in hex is +-0xRR00, the column is small (+-1) so doesn't need hex format.


A_EDGE2EDGE

private static final int[][] A_EDGE2EDGE
Used by getAdjacentEdgesToEdge(int). for each of the 3 edge directions, the (r,c) offsets for the 4 adjacent edges.

Decimal, not hex, because we need bounds-checking.
Order of directions: | / \


NODE_TO_NODE_2_AWAY

private static final int[] NODE_TO_NODE_2_AWAY
(r,c) Offsets from a node to another node 2 away, Indexed by the facing directions: SOCBoard.FACING_NE is 1, SOCBoard.FACING_E is 2, etc; SOCBoard.FACING_NW is 6. Used by getAdjacentNodeToNode2Away(int, int). The array contains 2 elements per facing.


hexLayoutLg

protected int[][] hexLayoutLg
Hex layout: water/land resource types. One element per hex. Order: [row][column].

Each element has the same format as SOCBoard.hexLayout: Each element's value encodes hex type and, if a port, its facing (SOCBoard.FACING_NE to SOCBoard.FACING_NW).

For land hexes, the dice number on hexLayoutLg[r][c] is numberLayoutLg[r][c].

For the set of all land hex coordinates, see landHexLayout. Hexes obscured by FOG_HEX, if any, are stored in fogHiddenHexes (server only). Because of bit shifts there, please don't use the top 8 bits of hexLayoutLg.

Key to the hexLayoutLg[][] values:

       0 : water   SOCBoard.WATER_HEX
       1 : clay    SOCBoard.CLAY_HEX
       2 : ore     SOCBoard.ORE_HEX
       3 : sheep   SOCBoard.SHEEP_HEX
       4 : wheat   SOCBoard.WHEAT_HEX
       5 : wood    SOCBoard.WOOD_HEX
       6 : desert  SOCBoard.DESERT_HEX
       7 : gold    GOLD_HEX (see its javadoc for rule)
       8 : fog     FOG_HEX  (see its javadoc for rule)  also: MAX_LAND_HEX_LG
       
Unless a hex's type here is SOCBoard.WATER_HEX, it's a land hex.

See Also:
SOCBoard.portsLayout

cachedGetLandHexCoords

protected int[] cachedGetLandHexCoords
The set of land hex coordinates within hexLayoutLg, as returned by getLandHexCoords(), or null. That method fills it from landHexLayout. If the board layout changes, this field again becomes null until the next call to getLandHexCoords().


landHexLayout

protected java.util.HashSet<java.lang.Integer> landHexLayout
The set of land hex coordinates within hexLayoutLg. Sent from server to client, along with the land hex types / dice numbers, via getLandHexLayout() / setLandHexLayout(int[]).


landAreasLegalNodes

protected java.util.HashSet<java.lang.Integer>[] landAreasLegalNodes
When the board has multiple "land areas" (groups of islands), this array holds each land area's nodes for settlements/cities. null otherwise. Each index holds the nodes for that land area number. Index 0 is unused (null).

The multiple land areas are used to restrict initial placement, or for other purposes during the game. If the players must start in a certain land area, startingLandArea != 0, and landAreasLegalNodes[startingLandArea] is also the players' potential settlement nodes.

The set SOCBoard.nodesOnLand contains all nodes of all land areas.


maxPlayers

protected final int maxPlayers
Maximum players (4 or 6). Some scenarios are laid out differently for 6 players. Some are laid out differently for 3 players, so also check SOCGameOption "PL".


startingLandArea

protected int startingLandArea
When players must start the game in a certain land area, the starting land area number; also its index in landAreasLegalNodes, because that set of legal nodes is also the players' potential settlement nodes. 0 if players can start anywhere and/or landAreasLegalNodes == null.

The startingLandArea and landAreasLegalNodes are sent from the server to client as part of a POTENTIALSETTLEMENTS message.


legalRoadEdges

protected java.util.HashSet<java.lang.Integer> legalRoadEdges
The legal set of land edge coordinates to build roads, based on SOCBoard.nodesOnLand. Calculated in initLegalRoadsFromLandNodes(), after SOCBoard.nodesOnLand is filled by SOCBoardLargeAtServer.makeNewBoard_fillNodesOnLandFromHexes(int[], int, int, int, boolean). Used by initPlayerLegalRoads().

See Also:
legalShipEdges

legalShipEdges

protected java.util.HashSet<java.lang.Integer> legalShipEdges
The legal set of water/coastline edge coordinates to build ships, based on hexLayoutLg. Calculated in initLegalShipEdges(), after hexLayoutLg is filled by SOCBoardLargeAtServer.makeNewBoard_fillNodesOnLandFromHexes(int[], int, int, int, boolean).

Used by initPlayerLegalShips(). Updated in revealFogHiddenHex(int, int, int) for WATER_HEX.

With scenario option _SC_PIRI, the legal edges vary per player and are based on SOCBoardLargeAtServer.PIR_ISL_SEA_EDGES, so legalShipEdges is empty.

See Also:
legalRoadEdges

numberLayoutLg

protected int[][] numberLayoutLg
Dice number from hex coordinate. Order: [row][column]. For land hexes, numberLayoutLg[r][c] is the dice number on hexLayoutLg[r][c]. One element per water, land, or port hex; non-land hexes are 0. Desert and fog hexes are -1, although getNumberOnHexFromNumber(int) returns 0 for them. Hex dice numbers obscured by FOG_HEX, if any, are stored in fogHiddenHexes (server only). Because of bit shifts there, numberLayoutLg values must stay within the range -1 to 254.

If villages are used, each village's dice number is stored in the SOCVillage.


addedLayoutParts

private java.util.HashMap<java.lang.String,int[]> addedLayoutParts
For some scenarios, keyed lists of additional layout parts to add to game layout when sent from server to client. For example, scenario SC_PIRI adds "PP" = { 0x..., 0x... } for the fixed Pirate Path, and SC_CLVI adds "CV" for the cloth village locations. Null for most scenarios. Initialized in SOCBoardLargeAtServer.makeNewBoard.


specialEdges

private java.util.HashMap<java.lang.Integer,java.lang.Integer> specialEdges
Map of special edge coordinates to types. If an edge has no key (coordinate) here, it is not a special edge. Not all possible edges are in this map, but all special edges are. Any edge has at most one Special Edge Type.

The Special Edge Types are constants such as SPECIAL_EDGE_DEV_CARD or SPECIAL_EDGE_SVP. See the SPECIAL_EDGE_DEV_CARD javadoc for more about Special Edges and related methods.

Calls to setAddedLayoutPart(String, int[]) add them to the specialEdges map if it recognizes the layout part as a special edge type.

Not many board layouts and scenarios have special edges, so this map is usually empty.


fogHiddenHexes

protected java.util.HashMap<java.lang.Integer,java.lang.Integer> fogHiddenHexes
Actual hex types and dice numbers hidden under FOG_HEX. Key is the hex coordinate; value is (hexLayoutLg[coord] << 8) | (numberLayoutLg[coord] & 0xFF).

Filled at server only (SOCBoardLargeAtServer.makeNewBoard_hideHexesInFog); the client doesn't know what's under the fog until hexes are revealed.

See Also:
revealFogHiddenHexPrep(int), revealFogHiddenHex(int, int, int)

villages

protected java.util.HashMap<java.lang.Integer,SOCVillage> villages
For some scenarios, villages on the board. Null otherwise. Each village has a dice number and a cloth count.


numCloth

private int numCloth
For some scenarios, how many cloth does the board have in its "general supply"? This supply is used if a village's SOCVillage.takeCloth(int) returns less than the amount needed.


playerExcludedLandAreas

private int[] playerExcludedLandAreas
Land area numbers from which the player is excluded and cannot place settlements, or null. This is never a long list. Used in some game scenarios.


robberExcludedLandAreas

private int[] robberExcludedLandAreas
Land areas numbers from which the robber is excluded and cannot be placed, or null. Used in some game scenarios.


portsCount

protected int portsCount
This board layout's number of ports; 0 if makeNewBoard(Map) hasn't been called yet. Port types, edges and facings are all stored in SOCBoard.portsLayout.


pirateHex

protected int pirateHex
the hex coordinate that the pirate is in, or 0; placed in makeNewBoard(Map). Once the pirate is placed on the board, it cannot be removed (cannot become 0 again) except in scenario SOCGameOption.K_SC_PIRI.


prevPirateHex

private int prevPirateHex
the previous hex coordinate that the pirate is in; 0 unless setPirateHex(rh, true) was called.

Constructor Detail

SOCBoardLarge

public SOCBoardLarge(java.util.Map<java.lang.String,SOCGameOption> gameOpts,
                     int maxPlayers)
              throws java.lang.IllegalArgumentException
Create a new Settlers of Catan Board, with the v3 encoding. The board will be empty (all hexes are water, no dice numbers on any hex), see class javadoc for how the board is filled when the game begins. Board height and width will be the default, BOARDHEIGHT_LARGE by BOARDWIDTH_LARGE.

Only the client uses this constructor.

Parameters:
gameOpts - if game has options, map of SOCGameOption; otherwise null.
maxPlayers - Maximum players; must be 4 or 6
Throws:
java.lang.IllegalArgumentException - if maxPlayers is not 4 or 6

SOCBoardLarge

public SOCBoardLarge(java.util.Map<java.lang.String,SOCGameOption> gameOpts,
                     int maxPlayers,
                     IntPair boardHeightWidth)
              throws java.lang.IllegalArgumentException
Create a new Settlers of Catan Board, with the v3 encoding and a certain size. The board will be empty (all hexes are water, no dice numbers on any hex), see class javadoc for how the board is filled when the game begins.

Parameters:
gameOpts - if game has options, map of SOCGameOption; otherwise null.
maxPlayers - Maximum players; must be 4 or 6
boardHeightWidth - Board's height and width. The constants for default size are BOARDHEIGHT_LARGE, BOARDWIDTH_LARGE.
Throws:
java.lang.IllegalArgumentException - if maxPlayers is not 4 or 6, or boardHeightWidth is null
Method Detail

getBoardSize

private static IntPair getBoardSize(java.util.Map<java.lang.String,SOCGameOption> gameOpts,
                                    int maxPlayers)
Get the board size for client's constructor: Default size BOARDHEIGHT_LARGE by BOARDWIDTH_LARGE, unless gameOpts contains "_BHW" Board Height and Width.

Parameters:
gameOpts - Game options, or null
maxPlayers - Maximum players; must be 4 or 6
Returns:
a new IntPair(height, width)
See Also:
SOCBoardLargeAtServer.getBoardSize(Map, int)

makeNewBoard

public void makeNewBoard(java.util.Map<java.lang.String,SOCGameOption> opts)
                  throws java.lang.UnsupportedOperationException
Shuffle the hex tiles and layout a board. This is called at server, but not at client; client instead calls methods such as setLandHexLayout(int[]) and setLegalAndPotentialSettlements(Collection, int, HashSet[]). Call soc.server.SOCBoardLargeAtServer.makeNewBoard instead of this stub super method.

Overrides:
makeNewBoard in class SOCBoard
Parameters:
opts - Game options, which may affect tile placement on board, or null. opts must be the same as passed to constructor, and thus give the same size and layout (same SOCBoard.getBoardEncodingFormat()).
Throws:
java.lang.UnsupportedOperationException - if called at client

initLegalRoadsFromLandNodes

protected void initLegalRoadsFromLandNodes()
                                    throws java.lang.IllegalStateException
Once the legal settlement/city nodes (SOCBoard.nodesOnLand) are established from land hexes, fill legalRoadEdges. Not iterative; clears all previous legal roads.

For scenarios, if Added Layout Part "AL" is present, checks it for references to node lists (Parts "N1", "N2", etc) and if found, adds their edges now so that initial settlements' roads can be built towards those nodes. For more info see the "Other layout parts" section of the javadoc for message SOCBoardLayout2.

Called at server and at client. At server, call this only after the very last call to SOCBoardLargeAtServer.makeNewBoard_fillNodesOnLandFromHexes(int[], int, int, int, boolean). At client, called from setLegalAndPotentialSettlements(Collection, int, HashSet[]).

Throws:
java.lang.IllegalStateException - if Part "AL" is present but badly formed (node list number 0, or a node list number not followed by a land area number) or refers to a node list Part ("N1", "N2", etc) not present in the layout
See Also:
initLegalShipEdges()

addLegalNodes

public final void addLegalNodes(int[] nodes,
                                int lan)
Add nodes to Nodes On Land and optionally to a a Land Area's legal nodes.

Called at server and client from SOCGame.updateAtGameFirstTurn() for node lists referenced in Added Layout Part "AL". For details see "AL" in the "Other layout parts" section of the javadoc for message BOARDLAYOUT2.

Currently does not add the new nodes' edges to legalRoadEdges, because it assumes the nodes are from Part "AL", so their edges were added in initLegalRoadsFromLandNodes().

Parameters:
nodes - Node coordinates to add. Not checked for validity, not checked to be land not water
lan - Land Area number to add legal nodes, or 0 to add only to Nodes On Land
Since:
2.0.00

initLegalShipEdges

protected void initLegalShipEdges()
Once the legal settlement/city nodes (SOCBoard.nodesOnLand) are established from land hexes, fill legalShipEdges. Contains all 6 edges of each water hex. Contains all coastal edges of each land hex at the edges of the board.

Not iterative; clears all previous legal ship edges. Call this only after the very last call to SOCBoardLargeAtServer.makeNewBoard_fillNodesOnLandFromHexes(int[], int, int, int, boolean) so that all land hexes are already placed.

Called at server and at client.

See Also:
initPlayerLegalShips(), initLegalRoadsFromLandNodes()

revealFogHiddenHexPrep

public int revealFogHiddenHexPrep(int hexCoord)
                           throws java.lang.IllegalArgumentException
Prepare to reveal one land or water hex hidden by fog (server-side call). Gets the hidden hex type and dice number, removes this hex's info from the set of hidden hexes.

This method does not reveal the hex: Game should call revealFogHiddenHex(int, int, int) and update any player or piece info affected.

Parameters:
hexCoord - Coordinate of the hex to reveal
Returns:
The revealed hex type and dice number, encoded as an int. Decode this way:
        final int hexType = encodedHexInfo >> 8;
        int diceNum = encodedHexInfo & 0xFF;
        if (diceNum == 0xFF)
            diceNum = 0;  
hexType is the same type of value as getHexTypeFromCoord(int).
Throws:
java.lang.IllegalArgumentException - if hexCoord isn't currently a FOG_HEX
See Also:
SOCGame.revealFogHiddenHex(int, int, int)

revealFogHiddenHex

void revealFogHiddenHex(int hexCoord,
                        int hexType,
                        int diceNum)
                  throws java.lang.IllegalArgumentException
Reveal one land or water hex hidden by fog (call from SOCGame). Called by SOCGame.revealFogHiddenHex(int, int, int) before updating player legal ship edges.

Parameters:
hexCoord - Coordinate of the hex to reveal
hexType - Revealed hex type, same value as getHexTypeFromCoord(int)
diceNum - Revealed hex dice number, same value as getNumberOnHexFromCoord(int), or 0
Throws:
java.lang.IllegalArgumentException - if hexCoord isn't currently a FOG_HEX
See Also:
revealFogHiddenHexPrep(int)

getHexLayout

@Deprecated
public int[] getHexLayout()
                   throws java.lang.UnsupportedOperationException
Deprecated. 

Get the hex layout -- Not valid for this encoding. Valid only for the v1 and v2 board encoding, not v3. Always throws UnsupportedOperationException for SOCBoardLarge. Call getLandHexCoords() instead. For sending a SOCBoardLayout2 message, call getLandHexLayout() instead.

Overrides:
getHexLayout in class SOCBoard
Returns:
the hex layout; meaning of values same as SOCBoard.hexLayout. Please treat the returned array as read-only.
Throws:
java.lang.UnsupportedOperationException - since the board encoding doesn't support this method; the v1 and v2 encodings do, but v3 (SOCBoard.BOARD_ENCODING_LARGE) does not.
See Also:
SOCBoard.getHexLayout()

setHexLayout

@Deprecated
public void setHexLayout(int[] hl)
                  throws java.lang.UnsupportedOperationException
Deprecated. 

Set the hexLayout -- Not valid for this encoding. Valid only for the v1 and v2 board encoding, not v3. Always throws UnsupportedOperationException for SOCBoardLarge. Call setLandHexLayout(int[]) instead.

Overrides:
setHexLayout in class SOCBoard
Parameters:
hl - the hex layout
Throws:
java.lang.UnsupportedOperationException - since the board encoding doesn't support this method; the v1 and v2 encodings do, but v3 (SOCBoard.BOARD_ENCODING_LARGE) does not.
See Also:
SOCBoard.setHexLayout(int[])

getNumberLayout

@Deprecated
public int[] getNumberLayout()
                      throws java.lang.UnsupportedOperationException
Deprecated. 

Get the dice-number layout of dice rolls at each hex number -- Not valid for this encoding. Call getLandHexCoords() and getNumberOnHexFromCoord(int) instead.

Overrides:
getNumberLayout in class SOCBoard
Returns:
the number layout; each element is valued 2-12. The robber hex is 0. Water hexes are -1.
Throws:
java.lang.UnsupportedOperationException - since the board encoding doesn't support this method; the v1 and v2 encodings do, but v3 (SOCBoard.BOARD_ENCODING_LARGE) does not.
See Also:
SOCBoard.getNumberLayout()

setNumberLayout

@Deprecated
public void setNumberLayout(int[] nl)
                     throws java.lang.UnsupportedOperationException
Deprecated. 

Set the number layout -- Not valid for this encoding. Call setLandHexLayout(int[]) instead.

Overrides:
setNumberLayout in class SOCBoard
Parameters:
nl - the number layout, from getNumberLayout()
Throws:
java.lang.UnsupportedOperationException - since the board encoding doesn't support this method; the v1 and v2 encodings do, but v3 (SOCBoard.BOARD_ENCODING_LARGE) does not.
See Also:
SOCBoard.setNumberLayout(int[])

getAddedLayoutParts

public java.util.HashMap<java.lang.String,int[]> getAddedLayoutParts()
Get the keyed lists of additional layout parts to add to game layout, used only in some scenarios. For example, scenario SC_PIRI adds "PP" = { 0x..., 0x... } for the fixed Pirate Path, and SC_CLVI adds "CV" for the cloth village locations. SC_WOND adds Node Lists "N1"-"N3" for wonder placement locations.

At the client, most of these are get/set with specific methods like setVillageAndClothLayout(int[]). A few such as "PP", "LS", and "N1"-"N3" just call getAddedLayoutPart(String).

Please treat the returned value as read-only. The layout part keys are documented at SOCBoardLayout2.

Added during SOCBoardLargeAtServer.makeNewBoard or SOCBoardLargeAtServer.startGame_putInitPieces.

Returns:
The added layout parts, or null if none
See Also:
getAddedLayoutPart(String), setAddedLayoutPart(String, int[])

getAddedLayoutPart

public int[] getAddedLayoutPart(java.lang.String key)
Get one "added layout part" by its key name. For more info, see class javadoc or getAddedLayoutParts(). The layout part keys are documented at SOCBoardLayout2.

Parameters:
key - Key name (short and uppercase)
Returns:
The added layout part, or null if none with that key

setAddedLayoutParts

public void setAddedLayoutParts(java.util.HashMap<java.lang.String,int[]> adds)
Set all the "added layout parts", for use at client. See setAddedLayoutPart(String, int[]) for details about the added layout parts.

If any layout part key in adds is recognized here as a Special Edge Type for getSpecialEdgeType(int), this method also adds them to the specialEdges map. Current Special Edge Type layout parts are listed in the setAddedLayoutPart(String, int[]) javadoc.

Parameters:
adds - Added parts, or null if none
See Also:
setAddedLayoutPart(String, int[])

setAddedLayoutPart

public void setAddedLayoutPart(java.lang.String key,
                               int[] v)
Set one "added layout part" by its key name. Should be set only during SOCBoardLargeAtServer.makeNewBoard or SOCBoardLargeAtServer.startGame_putInitPieces, not changed afterwards. Document the new key at SOCBoardLayout2.

If the layout part key is recognized here as a Special Edge Type for getSpecialEdgeType(int), this method also adds them to the specialEdges map. Current Special Edge Type layout parts are "CE" and "VE".

Parameters:
key - Key name (short and uppercase)
v - Value (typically a list of coordinates)
See Also:
setAddedLayoutParts(HashMap)

drawItemFromStack

public java.lang.Integer drawItemFromStack()
                                    throws java.lang.UnsupportedOperationException
If this scenario has dev cards or items waiting to be claimed by any player, draw the next item from that stack.

This is called at server, but not at client; client instead receives messages from the server when the player claims such an item. It's declared here in SOCBoardLarge instead of SOCBoardLargeAtServer so that game methods can call it without importing the server-side class.

In _SC_FTRI, each item is a SOCDevCardConstants card type.

Returns:
The next item from the stack, or null if empty or unused
Throws:
java.lang.UnsupportedOperationException - if called at client

placePort

void placePort(int ptype,
               int edge)
         throws java.lang.IllegalArgumentException
For scenario option _SC_FTRI, place a "gift" port at this edge. Port's facing direction is calculated by checking edge's adjacent hexes for land and water; if a hex is off the edge of the board, it's considered water.

Called from SOCGame.placePort(SOCPlayer, int, int) which validates ptype.

Parameters:
ptype - The type of port (in range MISC_PORT to WOOD_PORT)
edge - An available coastal edge
Throws:
java.lang.IllegalArgumentException - if edge is between 2 land hexes or 2 water hexes

movePirateHexAlongPath

public int movePirateHexAlongPath(int numSteps)
                           throws java.lang.UnsupportedOperationException,
                                  java.lang.IllegalStateException
For game scenario option _SC_PIRI, move the pirate fleet's position along its path.

This is called at server, but not at client; client instead calls setPirateHex(int, boolean). Call SOCBoardLargeAtServer.movePirateHexAlongPath instead of this stub super method.

Parameters:
numSteps - Number of steps to move along the path
Returns:
new pirate hex coordinate
Throws:
java.lang.UnsupportedOperationException - if called at client
java.lang.IllegalStateException - if this board doesn't have layout part "PP" for the Pirate Path.

setPirateHex

public void setPirateHex(int ph,
                         boolean rememberPrevious)
                  throws java.lang.IllegalArgumentException
Set where the pirate is, or take the pirate off the board.

For scenario _SC_PIRI, the server should call movePirateHexAlongPath(int) instead of directly calling this method.

Currently, the only scenario that removes the pirate from the board is _SC_PIRI.

Parameters:
ph - the new pirate hex coordinate, or 0 to take the pirate off the board; must be >= 0, not validated beyond that
rememberPrevious - Should we remember the old pirate hex?
Throws:
java.lang.IllegalArgumentException - if ph < 0
See Also:
getPirateHex(), getPreviousPirateHex(), SOCBoard.setRobberHex(int, boolean)

getPirateHex

public int getPirateHex()
Returns:
coordinate where the pirate is, or 0 if not on the board
See Also:
getPreviousPirateHex(), SOCBoard.getRobberHex()

getPreviousPirateHex

public int getPreviousPirateHex()
If the pirate has been moved by calling setPirateHex(int, boolean) where rememberPrevious == true, get the previous coordinate of the pirate.

Returns:
hex coordinate where the pirate was, or 0
See Also:
getPirateHex()

getPlayerExcludedLandAreas

public int[] getPlayerExcludedLandAreas()
Get the land area numbers, if any, from which all players are excluded and cannot place settlements. Used in some game scenarios.

Returns:
land area numbers, or null if none
See Also:
setPlayerExcludedLandAreas(int[]), getRobberExcludedLandAreas()

setPlayerExcludedLandAreas

public void setPlayerExcludedLandAreas(int[] px)
Set or clear the land area numbers from which all players are excluded and cannot place settlements. Used in some game scenarios.

Parameters:
px - Land area numbers, or null if none
See Also:
getPlayerExcludedLandAreas(), setRobberExcludedLandAreas(int[])

getRobberExcludedLandAreas

public int[] getRobberExcludedLandAreas()
Get the land area numbers, if any, from which the robber is excluded and cannot be placed. Used in some game scenarios.

Returns:
land area numbers, or null if none
See Also:
setRobberExcludedLandAreas(int[]), getPlayerExcludedLandAreas()

setRobberExcludedLandAreas

public void setRobberExcludedLandAreas(int[] rx)
Set or clear the land area numbers from which the robber is excluded and cannot be placed. Used in some game scenarios.

Parameters:
rx - Land area numbers, or null if none
See Also:
getRobberExcludedLandAreas(), setPlayerExcludedLandAreas(int[])

getNumberOnHexFromCoord

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

Overrides:
getNumberOnHexFromCoord in class SOCBoard
Parameters:
hex - the coordinates for a hex
Returns:
the dice-roll number on that hex, or 0 if no number or not a hex coordinate
See Also:
SOCBoard.getNumberOnHexFromNumber(int)

getNumberOnHexFromNumber

public int getNumberOnHexFromNumber(int hex)
Given a hex coordinate / hex number, return the (dice-roll) number on that hex

Overrides:
getNumberOnHexFromNumber in class SOCBoard
Parameters:
hex - the coordinates for a hex, or -1 if invalid
Returns:
the dice-roll number on that hex, or 0
See Also:
SOCBoard.getNumberOnHexFromCoord(int)

getHexNumFromCoord

@Deprecated
public int getHexNumFromCoord(int hexCoord)
                       throws java.lang.UnsupportedOperationException
Deprecated. 

Given a hex coordinate, return the hex number (index) -- Not valid for this encoding.

To get the dice number on a hex, call getNumberOnHexFromCoord(int).

Valid only for the v1 and v2 board encoding, not v3. Always throws UnsupportedOperationException for SOCBoardLarge. Hex numbers (indexes within an array of land hexes) aren't used in this encoding, hex coordinates are used instead.

Overrides:
getHexNumFromCoord in class SOCBoard
Parameters:
hexCoord - the coordinates ("ID") for a hex
Returns:
the hex number (index in numberLayout), or -1 if hexCoord isn't a hex coordinate on the board
Throws:
java.lang.UnsupportedOperationException - since the board encoding doesn't support this method
See Also:
getHexTypeFromCoord(int)

getHexTypeFromCoord

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

Unlike the original SOCBoard encoding, port types are not encoded in the hex layout; use SOCBoard.getPortTypeFromNodeCoord(int) instead.

The numeric value (7) for GOLD_HEX is the same as the v1/v2 encoding's SOCBoard.MISC_PORT_HEX, and FOG_HEX (8) is the same as SOCBoard.CLAY_PORT_HEX. The ports aren't encoded that way in SOCBoardLarge, so there is no ambiguity as long as callers check the board encoding format.

Overrides:
getHexTypeFromCoord in class SOCBoard
Parameters:
hex - the coordinates ("ID") for a hex
Returns:
the type of hex: Land in range SOCBoard.CLAY_HEX to SOCBoard.WOOD_HEX, SOCBoard.DESERT_HEX, GOLD_HEX, FOG_HEX, or SOCBoard.WATER_HEX. Invalid hex coordinates return -1.
See Also:
getLandHexCoords()

getHexTypeFromNumber

public int getHexTypeFromNumber(int hex)
Given a hex number, return the type of hex. In this encoding, hex numbers == hex coordinates.

Unlike the original SOCBoard encoding, port types are not encoded in the hex layout; use SOCBoard.getPortTypeFromNodeCoord(int) instead.

Overrides:
getHexTypeFromNumber in class SOCBoard
Parameters:
hex - the number of a hex, or -1 for invalid
Returns:
the type of hex: Land in range SOCBoard.CLAY_HEX to SOCBoard.WOOD_HEX, SOCBoard.DESERT_HEX, GOLD_HEX, FOG_HEX, or SOCBoard.WATER_HEX. Invalid hex numbers return -1.
See Also:
getHexTypeFromCoord(int)

getVillageAtNode

public SOCVillage getVillageAtNode(int nodeCoord)
If there's a village placed at this node during board setup, find it. Only some scenarios use villages.

Parameters:
nodeCoord - Node coordinate
Returns:
village, or null.
See Also:
getVillages()

isEdgeCoastline

public final boolean isEdgeCoastline(int edge)
Is this edge along the coastline (land/water border)? Off the edge of the board is considered water. FOG_HEX is considered land here.

Parameters:
edge - Edge coordinate, not checked for validity
Returns:
true if this edge's hexes are land and water, or a land hex at the edge of the board
See Also:
isHexCoastline(int), isNodeCoastline(int), getAdjacentEdgesToNode_coastal(int)

getLandHexCoordsSet

public java.util.HashSet<java.lang.Integer> getLandHexCoordsSet()
The hex coordinates of all land hexes. Please treat as read-only.

Returns:
land hex coordinates, as a set of Integers
Since:
2.0.00

getLandHexCoords

public int[] getLandHexCoords()
The hex coordinates of all land hexes.

Before v2.0.00, this was getHexLandCoords().

Overrides:
getLandHexCoords in class SOCBoard
Returns:
land hex coordinates, in no particular order, or null if none (all water).
Since:
1.1.08
See Also:
getLandHexCoordsSet()

putPiece

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

Except for SOCVillage, call pl.putPiece(pp) for each player before calling this method.

Overrides:
putPiece in class SOCBoard
Parameters:
pp - Piece to place on the board; coordinates are not checked for validity
See Also:
SOCBoard.removePiece(SOCPlayingPiece)

addLoneLegalSettlements

public void addLoneLegalSettlements(SOCGame ga,
                                    int[] ls)
                             throws java.lang.IllegalArgumentException
Add one legal settlement location to each player. The new location is alone by itself, outside of the other Land Areas where they can place. Used in some scenarios (_SC_PIRI) when SOCGame.hasSeaBoard. Assumes there aren't any settlements or cities on the board yet; does not check for adjacent pieces before making the location legal.

Parameters:
ga - Game, to get players; SOCBoard doesn't keep a reference to its game
ls - Each player's lone settlement node coordinate to add, indexed by player number, or null to do nothing. If an element is 0, nothing is added for that player.
Throws:
java.lang.IllegalArgumentException - if ls.length != ga.maxPlayers

hasSpecialEdges

public boolean hasSpecialEdges()
Does this board contain any Special Edges?

Returns:
True if a method setting special edges has been called, and the Special Edges map is not empty.

getSpecialEdgeType

public int getSpecialEdgeType(int edge)
Get this edge's Special Edge Type, if any.

Parameters:
edge - Edge coordinate
Returns:
A Special Edge Type code such as SPECIAL_EDGE_DEV_CARD or or SPECIAL_EDGE_SVP, or 0 if the edge isn't special or isn't a valid edge.
See Also:
getSpecialEdges(), setSpecialEdge(int, int), setSpecialEdges(int[], int), clearSpecialEdges(int)

getSpecialEdges

public java.util.Iterator<java.util.Map.Entry<java.lang.Integer,java.lang.Integer>> getSpecialEdges()
Get all Special Edge coordiates and their types. Please treat the returned iterator as read-only.

Returns:
An iterator over all items:
entry key = edge coordinate
value = edge's Special Edge Type code such as SPECIAL_EDGE_DEV_CARD
If the board has no special edges, the iterator is empty not null.
See Also:
getSpecialEdgeType(int)

setSpecialEdge

public void setSpecialEdge(int edge,
                           int seType)
Set an edge as a Special Edge, or clear that status and make it a normal edge. If an edge is already a different special edge type, its type will be changed to seType.

Parameters:
edge - Edge coordinate
seType - A special edge type code such as SPECIAL_EDGE_DEV_CARD or or SPECIAL_EDGE_SVP, or 0 if the edge isn't special

setSpecialEdges

public void setSpecialEdges(int[] edges,
                            int seType)
Set a list of edges as a certain type of special edge. If any of these edges is already a different special edge type, its type will be changed to seType. This method adds but does not remove any edges previously marked as that type, they will still be special. To clear previous edges of this special type, call clearSpecialEdges(int) before calling this method.

Parameters:
edges - List of edges to mark as special type code seType
seType - A special edge type code such as SPECIAL_EDGE_DEV_CARD or or SPECIAL_EDGE_SVP, or 0 to clear them (no longer special).

clearSpecialEdges

public void clearSpecialEdges(int seType)
Clear all edges marked as one special type. All special edges of that type will no longer be special.

Parameters:
seType - A special edge type code such as SPECIAL_EDGE_DEV_CARD or or SPECIAL_EDGE_SVP. 0 is ignored.

getVillageAndClothLayout

public int[] getVillageAndClothLayout()
Get the village and cloth layout, for sending from server to client for scenario game option SOCGameOption.K_SC_CLVI.

Index 0 is the board's "general supply" cloth count getCloth(). Index 1 is each village's starting cloth count, from SOCVillage.STARTING_CLOTH. Then, 2 int elements per village: Coordinate, Dice Number. If any village has a different amount of cloth, server should follow with messages to set those villages' cloth counts.

Returns:
the layout, or null if no villages.
See Also:
setVillageAndClothLayout(int[]), getVillages()

setVillageAndClothLayout

public void setVillageAndClothLayout(int[] villageNodesAndDice)
                              throws java.lang.NullPointerException,
                                     java.lang.IllegalArgumentException
For makeNewBoard(Map), with the Cloth Village scenario, create SOCVillages at these node locations. Adds to villages. Also set the board's "general supply" of cloth (setCloth(int)).

Parameters:
villageNodesAndDice - Starting cloth count and each village's node coordinate and dice number, grouped in pairs, from getVillageAndClothLayout().
Throws:
java.lang.NullPointerException - if array null
java.lang.IllegalArgumentException - if array length odd or < 4

getVillages

public java.util.HashMap<java.lang.Integer,SOCVillage> getVillages()
Get the SOCVillages on the board, for scenario game option SOCGameOption.K_SC_CLVI. Treat the returned data as read-only.

Returns:
villages, or null
See Also:
getVillageAtNode(int), getVillageAndClothLayout(), getCloth()

getCloth

public int getCloth()
Get how many cloth does the board have in its "general supply" (used in some scenarios). This supply is used if a village's SOCVillage.takeCloth(int) returns less than the amount needed.

See Also:
takeCloth(int), distributeClothFromRoll(SOCGame, int), getVillageAtNode(int)

setCloth

public void setCloth(int numCloth)
Set how many cloth the board currently has in its "general supply". For use at client based on messages from server.

Parameters:
numCloth - Number of cloth

takeCloth

public int takeCloth(int numTake)
Take this many cloth, if available, from the board's "general supply".

Parameters:
numTake - Number of cloth to try and take
Returns:
Number of cloth actually taken, a number from 0 to numTake.
See Also:
getCloth(), distributeClothFromRoll(SOCGame, int), SOCVillage.takeCloth(int)

distributeClothFromRoll

public int[] distributeClothFromRoll(SOCGame game,
                                     int dice)
Game action: Distribute cloth to players on a dice roll. Calls SOCVillage.distributeCloth(SOCGame) for matching village, if any. That calls takeCloth(int), SOCPlayer.setCloth(int), etc. Each player trading with that village gets at most 1 cloth. For scenario game option _SC_CLVI. This and any other dice-roll methods are called at server only.

Parameters:
game - Game with this board
dice - Rolled dice number
Returns:
null, or results as an array: [ Cloth amount taken from general supply, Matching village node coordinate, Cloth amount given to player 0, to player 1, ... to player n ].

isHexOnLand

public boolean isHexOnLand(int hexCoord)
Is this the coordinate of a land hex (not water)?

Overrides:
isHexOnLand in class SOCBoard
Parameters:
hexCoord - Hex coordinate, within the board's bounds
Returns:
True if land, false if water or not a valid hex coordinate
See Also:
isHexOnWater(int), isHexCoastline(int)

isHexOnWater

public boolean isHexOnWater(int hexCoord)
Is this the coordinate of a water hex (not land)?

Overrides:
isHexOnWater in class SOCBoard
Parameters:
hexCoord - Hex coordinate, within the board's bounds
Returns:
True if water, false if land or not a valid hex coordinate
Since:
2.0.00
See Also:
isHexOnLand(int), isHexCoastline(int)

isHexCoastline

public boolean isHexCoastline(int hexCoord)
                       throws java.lang.IllegalArgumentException
Is this land hex along the coastline (land/water border)? Off the edge of the board is considered water. FOG_HEX is considered land here.

Parameters:
hexCoord - Hex coordinate, within the board's bounds
Returns:
true if this hex is adjacent to water, or at the edge of the board
Throws:
java.lang.IllegalArgumentException - if hexCoord is water or not a valid hex coordinate
See Also:
isEdgeCoastline(int), isNodeCoastline(int)

isHexInLandAreas

public boolean isHexInLandAreas(int hexCoord,
                                int[] las)
Is this hex's land area in this list of land areas?

Parameters:
hexCoord - The hex coordinate, within the board's bounds
las - List of land area numbers, or null for an empty list
Returns:
True if any landarea in las[i] contains hexCoord; false otherwise, or if getLandAreasLegalNodes() is null
See Also:
isHexOnLand(int)

isNodeInLandAreas

public boolean isNodeInLandAreas(int nodeCoord,
                                 int[] las)
Is this node's land area in this list of land areas?

Some nodes on land do not have a land area; instead of using this method to determine if a node is on land, use SOCBoard.isNodeOnLand(int) or isNodeCoastline(int).

Parameters:
nodeCoord - The node's coordinate
las - List of land area numbers, or null for an empty list
Returns:
True if las contains getNodeLandArea(nodeCoord); false otherwise, or if getLandAreasLegalNodes() is null

getNodeLandArea

public int getNodeLandArea(int nodeCoord)
Get a node's Land Area number, if applicable.

Parameters:
nodeCoord - the node's coordinate
Returns:
The node's land area, if any, or 0 if not found or if in water. If getLandAreasLegalNodes() is null, always returns 1 if isNodeOnLand(nodeCoord).
See Also:
getLandAreasLegalNodes(), isNodeInLandAreas(int, int[])

isNodeCoastline

public final boolean isNodeCoastline(int node)
Is this node along the coastline (land/water border)? Off the edge of the board is considered water. FOG_HEX is considered land here.

Parameters:
node - Node coordinate, not checked for validity
Returns:
true if this node's adjacent hexes are land and water, or if any adjacent hex would be off the edge of the board
See Also:
isEdgeCoastline(int), isHexCoastline(int), getAdjacentEdgesToNode_coastal(int)

getLandHexLayout

public int[] getLandHexLayout()
Get the land hex layout, for sending from server to client. Contains 3 int elements per land hex: Coordinate, Hex type (resource, as in SOCBoard.SHEEP_HEX), Dice Number (-1 for desert).

Returns:
the layout, or null if no land hexes.
See Also:
setLandHexLayout(int[])

setLandHexLayout

public void setLandHexLayout(int[] lh)
Set the land hex layout, sent from server to client. Contains 3 int elements per land hex: Coordinate, Hex type (resource), Dice Number. Clears landHexLayout, diceLayoutLg, numberLayoutLg, nodesOnLand and legalRoadEdges before beginning.

After calling this, please call game.setPlayersLandHexCoordinates(). After makeNewBoard(Map) calculates the potential/legal settlements, call each player's SOCPlayer.setPotentialAndLegalSettlements(Collection, boolean, HashSet[]).

Parameters:
lh - the layout, or null if no land hexes, from getLandHexLayout()

getStartingLandArea

public int getStartingLandArea()
Get the starting land area, if multiple "land areas" are used and the players must start the game in a certain land area.

This is enforced during makeNewBoard(Map), by using that land area for the only initial potential/legal settlement locations.

Returns:
the starting land area number; also its index in getLandAreasLegalNodes(). 0 if players can start anywhere and/or landAreasLegalNodes == null.
See Also:
SOCPlayer.getStartingLandAreasEncoded()

getLandAreasLegalNodes

public java.util.HashSet<java.lang.Integer>[] getLandAreasLegalNodes()
Get the land areas' nodes, if multiple "land areas" are used. For use only by SOCGame at server. Please treat the returned object as read-only.

When the board has multiple "land areas" (groups of islands, or subsets of islands), this array holds each land area's nodes for settlements/cities.

The multiple land areas are used to restrict initial placement, or for other purposes during the game. If the players must start in a certain land area, startingLandArea != 0.

See also getLegalAndPotentialSettlements() which returns the starting land area's nodes, or if no starting land area, all nodes of all land areas.

See also getStartingLandArea() to see if the players must start the game in a certain land area.

Returns:
the land areas' nodes, or null if only one land area (one group of islands). Each index holds the nodes for that land area number. Index 0 is unused.
See Also:
getNodeLandArea(int)

getLegalAndPotentialSettlements

public java.util.HashSet<java.lang.Integer> getLegalAndPotentialSettlements()
Get the legal and potential settlements, after makeNewBoard(Map). For use mainly by SOCGame at server.

Returns the starting land area's nodes, or if no starting land area, all nodes of all land areas.

At the client, this returns an empty set if setLegalAndPotentialSettlements(Collection, int, HashSet[]) hasn't yet been called while the game is starting.

See also getLandAreasLegalNodes() which returns all the legal nodes when multiple "land areas" are used.


setLegalAndPotentialSettlements

public void setLegalAndPotentialSettlements(java.util.Collection<java.lang.Integer> psNodes,
                                            int sla,
                                            java.util.HashSet<java.lang.Integer>[] lan)
                                     throws java.lang.IllegalStateException
Set the legal and potential settlements, and calculate the Nodes On Land, legal roads and ship edges. Called at client only, when server sends potential settlements following the board layout message.

Nodes On Land will be the union of all lan[] nodes; legal roads are calculated from Nodes On Land. If sla != 0, then lan[sla] is also the set of potential settlement locations for initial placement. If any nodes have been removed from lan[sla] due to scenario rules, but will be valid after initial placement, those nodes must be referenced in Added Layout Part "AL" for that to automatically happen and for their adjacent edges to be part of the legal roads calculated here. For details see the "Other layout parts" section of the javadoc for message SOCBoardLayout2.

Call this only after setLandHexLayout(int[]). After calling this method, you can get the new legal road set with initPlayerLegalRoads().

If this method hasn't yet been called, getLegalAndPotentialSettlements() returns an empty set.

In some scenarios (_SC_PIRI), not all sea edges are legal for ships. See SOCPlayer.setRestrictedLegalShips(int[]) and SOCBoardLargeAtServer.getLegalSeaEdges(SOCGame, int).

Server doesn't need to call this method, because SOCBoardLargeAtServer.makeNewBoard(Map) sets the contents of the same data structures.

Parameters:
psNodes - The set of potential settlement node coordinates as Integers; either a HashSet or Vector. If lan == null, this will also be used as the legal set of settlement nodes on land.
sla - The required starting Land Area number, or 0
lan - If non-null, all Land Areas' legal node coordinates. Index 0 is ignored; land area numbers start at 1.
Throws:
java.lang.IllegalStateException - if Added Layout Part "AL" is present but badly formed (node list number 0, or a node list number not followed by a land area number). This Added Layout Part is rarely used, and this would be discovered quickly while testing the board layout that contained it.

initPlayerLegalRoads

java.util.HashSet<java.lang.Integer> initPlayerLegalRoads()
Create and initialize a SOCPlayer's legalRoads set.

Because the v3 board layout varies: At the server, call this after makeNewBoard(Map). At the client, call this after setLegalAndPotentialSettlements(Collection, int, HashSet[]).

Overrides:
initPlayerLegalRoads in class SOCBoard
Returns:
the set of legal edge coordinates for roads, as a new Set of Integers
Since:
1.1.12

initPlayerLegalShips

java.util.HashSet<java.lang.Integer> initPlayerLegalShips()
Create and initialize a SOCPlayer's legalShips set. Contains all 6 edges of each water hex.

Because the v3 board layout varies: At the server, call this after makeNewBoard(Map). At the client, call this after setLegalAndPotentialSettlements(Collection, int, HashSet[]).

Returns:
the set of legal edge coordinates for ships, as a new Set of Integers
Since:
2.0.00

getAdjacentHexesToHex

public java.util.Vector<java.lang.Integer> getAdjacentHexesToHex(int hexCoord,
                                                                 boolean includeWater)
Make a list of all valid hex coordinates (or, only land) adjacent to this hex. Valid coordinates are those within the board coordinate limits (SOCBoard.getBoardHeight(), SOCBoard.getBoardWidth()).

Coordinate offsets - adjacent hexes to hex:

   (-2,-1) (-2,+1)

 (0,-2)   x   (0,+2)

   (+2,-1) (+2,+1)  

Overrides:
getAdjacentHexesToHex in class SOCBoard
Parameters:
hexCoord - Coordinate ("ID") of this hex; not checked for validity
includeWater - Should water hexes be returned (not only land ones)?
Returns:
the hexes that touch this hex, as a Vector of Integer coordinates, or null if none are adjacent (will not return a 0-length vector)
See Also:
isHexAdjacentToHex(int, int), isHexInBounds(int, int), isHexCoastline(int)

getAdjacentHexes2Hex_AddIfOK

private final void getAdjacentHexes2Hex_AddIfOK(java.util.Vector<java.lang.Integer> addTo,
                                                boolean includeWater,
                                                int r,
                                                int c)
Check one possible coordinate for getAdjacentHexesToHex.

Parameters:
addTo - the list we're building of hexes that touch this hex, as a Vector of Integer coordinates.
includeWater - Should water hexes be returned (not only land ones)?
r - Hex row coordinate
c - Hex column coordinate

isHexAdjacentToHex

public boolean isHexAdjacentToHex(int hex1Coord,
                                  int hex2Coord)
Are these hexes adjacent?

Parameters:
hex1Coord - First hex coordinate; not checked for validity
hex2Coord - Second hex coordinate; not checked for validity
Returns:
true if adjacent
See Also:
getAdjacentHexesToHex(int, boolean)

getAdjacentEdgesToHex

public int[] getAdjacentEdgesToHex(int hexCoord)
The edge coordinates adjacent to this hex in all 6 directions. (The 6 sides of this hex.) Since all hexes have 6 edges, all edge coordinates are valid if the hex coordinate is valid.

Parameters:
hexCoord - Coordinate of this hex; not checked for validity
Returns:
The 6 edges adjacent to this hex
Since:
2.0.00

isEdgeAdjacentToHex

public boolean isEdgeAdjacentToHex(int edgeCoord,
                                   int hexCoord)
Is this edge adjacent to this hex? (Is it one of the 6 sides of the hex?)

Parameters:
edgeCoord - Coordinate of the edge; not checked for validity
hexCoord - Hex coordinate; not checked for validity
Returns:
true if adjacent

getAdjacentNodeToHex

public int getAdjacentNodeToHex(int hexCoord,
                                int dir)
                         throws java.lang.IllegalArgumentException
The node coordinate adjacent to this hex in a given direction. Since all hexes have 6 nodes, all node coordinates are valid if the hex coordinate is valid.

Overrides:
getAdjacentNodeToHex in class SOCBoard
Parameters:
hexCoord - Coordinate ("ID") of this hex
dir - Direction, clockwise from top (northern point of hex): 0 is north, 1 is northeast, etc, 5 is northwest.
Returns:
Node coordinate in that direction
Throws:
java.lang.IllegalArgumentException - if dir < 0 or dir > 5

getAdjacentNodesToHex

public int[] getAdjacentNodesToHex(int hexCoord)
The node coordinates adjacent to this hex in all 6 directions. (The 6 corners of this hex.) Since all hexes have 6 nodes, all node coordinates are valid if the hex coordinate is valid.

Overrides:
getAdjacentNodesToHex in class SOCBoard
Parameters:
hexCoord - Coordinate of this hex; not checked for validity
Returns:
Node coordinate in all 6 directions, clockwise from top (northern point of hex): 0 is north, 1 is northeast, etc, 5 is northwest.
Since:
2.0.00
See Also:
getAdjacentNodeToHex(int, int)

getAdjacentHexToEdge

public int getAdjacentHexToEdge(int edgeCoord,
                                int facing)
                         throws java.lang.IllegalArgumentException
The hex touching an edge in a given direction, either along its length or at one end node. Each edge touches up to 4 valid hexes.

Overrides:
getAdjacentHexToEdge in class SOCBoard
Parameters:
edgeCoord - The edge's coordinate. Not checked for validity.
facing - Facing from edge; 1 to 6. This will be either a direction perpendicular to the edge, or towards one end. Each end has two facing directions angled towards it; both will return the same hex. Facing 2 is SOCBoard.FACING_E, 3 is SOCBoard.FACING_SE, 4 is SW, etc.
Returns:
hex coordinate of hex in the facing direction, or 0 if that hex would be off the edge of the board.
Throws:
java.lang.IllegalArgumentException - if facing < 1 or facing > 6
See Also:
getAdjacentHexesToEdge_arr(int), getAdjacentHexesToEdgeEnds(int)

getAdjacentHexesToEdge_arr

public int[] getAdjacentHexesToEdge_arr(int edgeCoord)
                                 throws java.lang.IllegalArgumentException
The valid hex or two hexes touching an edge along its length.

Parameters:
edgeCoord - The edge's coordinate. Not checked for validity.
Returns:
hex coordinate of each adjacent hex, or 0 if that hex would be off the edge of the board.
Throws:
java.lang.IllegalArgumentException
See Also:
getAdjacentHexToEdge(int, int), getAdjacentHexesToEdgeEnds(int)

getAdjacentHexesToEdgeEnds

public int[] getAdjacentHexesToEdgeEnds(int edgeCoord)
                                 throws java.lang.IllegalArgumentException
The valid hex or two hexes past each end of an edge. The edge connects these two hexes. For a north-south edge, for example, they would be north and south of the edge.

Parameters:
edgeCoord - The edge's coordinate. Not checked for validity.
Returns:
2-element array with hex coordinate of each hex, or 0 if that hex would be off the edge of the board.
Throws:
java.lang.IllegalArgumentException
See Also:
getAdjacentHexToEdge(int, int), getAdjacentHexesToEdge_arr(int)

getAdjacentEdgesToEdge

public java.util.Vector<java.lang.Integer> getAdjacentEdgesToEdge(int coord)
Get the edge coordinates of the 2 to 4 edges adjacent to this edge.

Overrides:
getAdjacentEdgesToEdge in class SOCBoard
Parameters:
coord - Edge coordinate; not checked for validity
Returns:
the valid adjacent edges to this edge, as a Vector of Integer coordinates. If coord is off the board, none of its adjacents will be in bounds, and this method will return an empty list; never returns null.

getAdjacentNodeToEdge

public int getAdjacentNodeToEdge(int edgeCoord,
                                 int facing)
                          throws java.lang.IllegalArgumentException
The node at the end of an edge in a given direction.

Parameters:
edgeCoord - The edge's coordinate. Not checked for validity.
facing - Direction along the edge towards the node; 1 to 6. To face southeast along a diagonal edge, use SOCBoard.FACING_SE. To face north along a vertical edge, use either SOCBoard.FACING_NW or SOCBoard.FACING_NE.
Returns:
node coordinate of node in the facing direction. If edgeCoord is valid, both its node coordinates are valid and on the board.
Throws:
java.lang.IllegalArgumentException - if facing < 1 or facing > 6, or if the facing is perpendicular to the edge direction. (SOCBoard.FACING_E or SOCBoard.FACING_W for a north-south vertical edge, SOCBoard.FACING_NW for a northeast-southwest edge, etc.)
See Also:
getAdjacentNodesToEdge(int)

getAdjacentNodesToEdge

public java.util.Vector<java.lang.Integer> getAdjacentNodesToEdge(int coord)
Adjacent node coordinates to an edge (that is, the nodes that are the two ends of the edge).

Overrides:
getAdjacentNodesToEdge in class SOCBoard
Returns:
the nodes that touch this edge, as a Vector of Integer coordinates
See Also:
getAdjacentNodesToEdge_arr(int), getAdjacentNodeToEdge(int, int)

getAdjacentNodesToEdge_arr

public int[] getAdjacentNodesToEdge_arr(int coord)
Adjacent node coordinates to an edge (that is, the nodes that are the two ends of the edge).

Overrides:
getAdjacentNodesToEdge_arr in class SOCBoard
Parameters:
coord - Edge coordinate; not checked for validity
Returns:
the nodes that touch this edge, as an array of 2 integer coordinates
See Also:
getAdjacentNodesToEdge(int), getAdjacentNodeToEdge(int, int), getNodeBetweenAdjacentEdges(int, int)

getNodeBetweenAdjacentEdges

public int getNodeBetweenAdjacentEdges(int edgeA,
                                       int edgeB)
                                throws java.lang.IllegalArgumentException
Given a pair of adjacent edge coordinates, get the node coordinate that connects them.

Does not check actual settlements or other pieces on the board.

Parameters:
edgeA - Edge coordinate adjacent to edgeB; not checked for validity
edgeB - Edge coordinate adjacent to edgeA; not checked for validity
Returns:
node coordinate between edgeA and edgeB
Throws:
java.lang.IllegalArgumentException - if edgeA and edgeB aren't adjacent
See Also:
getAdjacentNodesToEdge(int)

getAdjacentHexesToNode

public java.util.Vector<java.lang.Integer> getAdjacentHexesToNode(int nodeCoord)
Get the coordinates of the hexes adjacent to this node. These hexes may contain land or water.

Overrides:
getAdjacentHexesToNode in class SOCBoard
Parameters:
nodeCoord - Node coordinate. Is not checked for validity.
Returns:
the coordinates (Integers) of the 1 to 3 hexes touching this node, within the boundaries (1, 1, boardHeight-1, boardWidth-1) because hex coordinates (their centers) are fully within the board.

getAdjacentEdgeToNode

public int getAdjacentEdgeToNode(int nodeCoord,
                                 int nodeDir)
                          throws java.lang.IllegalArgumentException
Given a node, get the valid adjacent edge in a given direction, if any.

Along the edge of the board layout, valid land nodes have some adjacent edges which may be "off the board" and thus invalid; check the return value.

Overrides:
getAdjacentEdgeToNode in class SOCBoard
Parameters:
nodeCoord - Node coordinate to go from; not checked for validity.
nodeDir - 0 for northwest or southwest; 1 for northeast or southeast; 2 for north or south
Returns:
The adjacent edge in that direction, or -9 if none (if off the board)
Throws:
java.lang.IllegalArgumentException - if nodeDir is less than 0 or greater than 2
See Also:
SOCBoard.getAdjacentEdgesToNode(int), getEdgeBetweenAdjacentNodes(int, int), getAdjacentNodeToNode(int, int)

getEdgeBetweenAdjacentNodes

public int getEdgeBetweenAdjacentNodes(int nodeA,
                                       int nodeB)
Given a pair of adjacent node coordinates, get the edge coordinate that connects them.

Does not check actual roads or other pieces on the board.

Overrides:
getEdgeBetweenAdjacentNodes in class SOCBoard
Parameters:
nodeA - Node coordinate adjacent to nodeB; not checked for validity
nodeB - Node coordinate adjacent to nodeA; not checked for validity
Returns:
edge coordinate, or -9 if nodeA and nodeB aren't adjacent
See Also:
SOCBoard.getAdjacentEdgesToNode(int), getAdjacentEdgeToNode(int, int)

isEdgeAdjacentToNode

public boolean isEdgeAdjacentToNode(int nodeCoord,
                                    int edgeCoord)
Determine if this node and edge are adjacent.

Overrides:
isEdgeAdjacentToNode in class SOCBoard
Parameters:
nodeCoord - Node coordinate; not bounds-checked
edgeCoord - Edge coordinate; bounds-checked against board boundaries.
Returns:
is the edge in-bounds and adjacent?
See Also:
getEdgeBetweenAdjacentNodes(int, int)

getAdjacentEdgesToNode_coastal

public final java.util.List<java.lang.Integer> getAdjacentEdgesToNode_coastal(int node)
Get the coastal (land+water) edges adjacent to this node, if any.

Coastal edges are those with an adjacent land hex and an adjacent water hex. FOG_HEX is considered land here. Hexes off the board are considered water. Edges off the board are ignored, not checked here.

Parameters:
node - Node coordinate; not validated. Should be a coastal node, with adjacent water and land hexes, although you can pass inland or at-sea nodes to this method.
Returns:
Coastal edges adjacent to node, or an empty list if none
See Also:
isEdgeCoastline(int), isNodeCoastline(int)

getAdjacentNodeToNode

public int getAdjacentNodeToNode(int nodeCoord,
                                 int nodeDir)
                          throws java.lang.IllegalArgumentException
Given a node, get the valid adjacent node in a given direction, if any. At the edge of the layout, some adjacent nodes/edges may be "off the board" and thus invalid.

Overrides:
getAdjacentNodeToNode in class SOCBoard
Parameters:
nodeCoord - Node coordinate to go from; not checked for validity.
nodeDir - 0 for northwest or southwest; 1 for northeast or southeast; 2 for north or south
Returns:
The adjacent node in that direction, or -9 if none (if off the board)
Throws:
java.lang.IllegalArgumentException - if nodeDir is less than 0 or greater than 2
See Also:
SOCBoard.getAdjacentNodesToNode(int), getAdjacentNodeToNode2Away(int, int), getAdjacentEdgeToNode(int, int), SOCBoard.isNodeAdjacentToNode(int, int)

getAdjacentEdgeToNode2Away

public int getAdjacentEdgeToNode2Away(int node,
                                      int node2away)
Given an initial node, and a second node 2 nodes away, calculate the road/edge coordinate (adjacent to the initial node) going towards the second node.

Overrides:
getAdjacentEdgeToNode2Away in class SOCBoard
Parameters:
node - Initial node coordinate; not validated
node2away - Second node coordinate; should be 2 away, but this is not validated
Returns:
An edge coordinate, adjacent to initial node, in the direction of the second node.
See Also:
getAdjacentNodeToNode2Away(int, int)

getAdjacentNodeToNode2Away

public int getAdjacentNodeToNode2Away(int nodeCoord,
                                      int facing)
                               throws java.lang.IllegalArgumentException
Get the coordinate of another node 2 away, based on a starting node. Facing is indexed by the facing directions: SOCBoard.FACING_NE is 1, SOCBoard.FACING_E is 2, etc; SOCBoard.FACING_NW is 6.

Overrides:
getAdjacentNodeToNode2Away in class SOCBoard
Parameters:
nodeCoord - Starting node's coordinate
facing - Facing from node; 1 to 6. This will be one of the 6 directions from a node to another node 2 away. Facing 2 is SOCBoard.FACING_E, 3 is SOCBoard.FACING_SE, 4 is SW, etc.
Returns:
the node coordinate, or -9 if that node is not on the board.
Throws:
java.lang.IllegalArgumentException - if facing < 1 or facing > 6
See Also:
getAdjacentNodeToNode(int, int), getAdjacentEdgeToNode2Away(int, int), isNode2AwayFromNode(int, int)

isNode2AwayFromNode

public boolean isNode2AwayFromNode(int n1,
                                   int n2)
Determine if these 2 nodes are 2 nodes apart on the board, by the node coordinate arithmetic.

Overrides:
isNode2AwayFromNode in class SOCBoard
Parameters:
n1 - Node coordinate; not validated
n2 - Node coordinate; not validated
Returns:
are these nodes 2 away from each other?
See Also:
getAdjacentNodeToNode2Away(int, int)

isHexInBounds

public final boolean isHexInBounds(int r,
                                   int c)
Is this hex coordinate within the board's boundaries, not off the side of the board?

Parameters:
r - Hex coordinate's row; bounds-checked and validity-checked (only odd rows are hex coordinate rows)
c - Hex coordinate's column; bounds-checked but not validity-checked (could be a column betwen two hexes, or could be c == 1 although half the hex rows start at 2)
See Also:
getAdjacentHexesToHex(int, boolean), isHexAtBoardMargin(int)

isHexAtBoardMargin

public final boolean isHexAtBoardMargin(int hexCoord)
Is this hex coordinate at the board's boundaries, with one or more adjacent hexes off the side of the board?

Parameters:
hexCoord - Hex coordinate; not validity-checked
See Also:
isHexInBounds(int, int)

isNodeInBounds

public final boolean isNodeInBounds(int r,
                                    int c)
Is this an edge coordinate within the board's boundaries, not overlapping or off the side of the board? TODO description... valid range for nodes(corners) of hexes laid out, but doesn't check for "misalignment" in the middle of the board.

Parameters:
r - Node coordinate's row
c - Node coordinate's column
See Also:
isHexInBounds(int, int), isEdgeInBounds(int, int), SOCBoard.isNodeOnLand(int)

isEdgeInBounds

public final boolean isEdgeInBounds(int r,
                                    int c)
Is this an edge coordinate within the board's boundaries, not overlapping or off the side of the board? TODO description... valid range for edges(sides) of hexes laid out, but doesn't check for "misalignment" in the middle of the board.

Parameters:
r - Edge coordinate's row
c - Edge coordinate's column
See Also:
isHexInBounds(int, int), isNodeInBounds(int, int)

getPortsCount

public int getPortsCount()
Description copied from class: SOCBoard
Get the number of ports on this board. The original and 6-player board layouts each have a constant number of ports. The v3 layout (SOCBoard.BOARD_ENCODING_LARGE) has a varying amount of ports, set during SOCBoard.makeNewBoard(Map).

Overrides:
getPortsCount in class SOCBoard
Returns:
the number of ports on this board; might be 0 if SOCBoard.makeNewBoard(Map) hasn't been called yet.

setPortsLayout

public void setPortsLayout(int[] portTypesAndInfo)
Set the port information at the client, sent from the server from SOCBoard.getPortsLayout().

Note: This v3 layout (SOCBoard.BOARD_ENCODING_LARGE) stores more information within the port layout array. If you call setPortsLayout(int[]), be sure you are giving all information returned by SOCBoard.getPortsLayout(), not just the port types.

Overrides:
setPortsLayout in class SOCBoard
See Also:
SOCBoard.getPortsLayout()

getPortsEdges

public int[] getPortsEdges()
Description copied from class: SOCBoard
Each port's edge coordinate. This is the edge whose 2 end nodes can be used to build port settlements/cities. Same order as SOCBoard.getPortsLayout(): Clockwise from upper-left. The length of this array is always SOCBoard.getPortsCount().

This method should not be called frequently.

A scenario of SOCBoardLarge has movable ports; a port's edge there might temporarily be -1. Ignore this port if so, it's not currently placed on the board. This happens only with SOCBoardLarge (layout encoding v3), not the original or 6-player (v1 or v2) SOCBoard layouts.

Overrides:
getPortsEdges in class SOCBoard
Returns:
the ports' edges
See Also:
SOCBoard.getPortsFacing(), SOCBoard.getPortCoordinates(int)

getPortsFacing

public int[] getPortsFacing()
Description copied from class: SOCBoard
Each port's facing, such as SOCBoard.FACING_NW. Port Facing is the direction from the port hex, to the land hex touching it which will have 2 nodes where a port settlement/city can be built. Same order as SOCBoard.getPortsLayout(): Clockwise from upper-left. The length of this array is always SOCBoard.getPortsCount().

This method should not be called frequently.

Overrides:
getPortsFacing in class SOCBoard
Returns:
the ports' facing
See Also:
SOCBoard.getPortsEdges()

getPortEdgeFromNode

public int getPortEdgeFromNode(int node)
Find the port edge, if any, that touches this node.

Parameters:
node - Node coordinate. If coordinate is not valid, it won't have a port.
Returns:
Port edge adjacent to this node, or -9 if none
Since:
2.0.00

getPortFacingFromEdge

public int getPortFacingFromEdge(int edge)
                          throws java.lang.IllegalArgumentException
Given a coastal edge, find the "port facing" direction (towards land) for that edge. Calculated by checking edge's adjacent hexes for land and water; if a hex is off the edge of the board, it's considered water.

Parameters:
edge - A coastal edge; not validated here, must be a possible coordinate for an edge
Returns:
Coastal edge's port facing (towards land): In the range FACING_NE, FACING_E, ... FACING_NW
Throws:
java.lang.IllegalArgumentException - if edge is between 2 land hexes or 2 water hexes

canRemovePort

public boolean canRemovePort(int edge)
For scenario option _SC_FTRI, can a "gift" port at this edge be removed for placement elsewhere?

A port can't be removed from a Land Area where the player can place settlements. So, must be in no land area (LA == 0), or in getPlayerExcludedLandAreas(). Does not check whether SOCGameOption.K_SC_FTRI is set.

Parameters:
edge - Port's edge coordinate
Returns:
True if that edge has a port which can be removed
See Also:
removePort(int), SOCGame.canRemovePort(SOCPlayer, int), SOCGame.canPlacePort(SOCPlayer, int)

removePort

public int removePort(int edge)
               throws java.lang.IllegalArgumentException
For scenario option _SC_FTRI, remove a "gift" port at this edge for placement elsewhere.

Assumes canRemovePort(int) has already been called to validate. See that method for necessary board conditions.

Parameters:
edge - A port edge to be removed
Returns:
The type of port removed (in range MISC_PORT to WOOD_PORT)
Throws:
java.lang.IllegalArgumentException - if edge not found in port layout
See Also:
SOCGame.removePort(SOCPlayer, int), SOCGame.placePort(SOCPlayer, int, int)

edgeCoordToString

public java.lang.String edgeCoordToString(int edge)
Get the dice roll numbers for hexes on either side of this edge.

Overrides:
edgeCoordToString in class SOCBoard
Returns:
a string representation of an edge coordinate's dice numbers, such as "5/3"; if a hex isn't a land hex, its number will be 0.
See Also:
getNumberOnHexFromCoord(int)