|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.game.SOCBoard soc.game.SOCBoardLarge
public class SOCBoardLarge
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
.
SOCBoardLarge
and don't appear in the parent SOCBoard
.
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) ..
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. |
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 SOCVillage s 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 SOCVillage s at these node locations. |
int |
takeCloth(int numTake)
Take this many cloth, if available, from the board's "general supply". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final int VERSION_FOR_ENCODING_LARGE
SOCBoard.BOARD_ENCODING_LARGE
was introduced in version 2.0.00 (2000)
public static final int GOLD_HEX
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.
public static final int FOG_HEX
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.
revealFogHiddenHexPrep(int)
,
revealFogHiddenHex(int, int, int)
,
Constant Field Valuesprotected static final int MAX_LAND_HEX_LG
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.
public static final int BOARDHEIGHT_LARGE
getBoardHeight()
, getBoardWidth()
.
public static final int BOARDWIDTH_LARGE
getBoardHeight()
, getBoardWidth()
.
public static final int SPECIAL_EDGE_DEV_CARD
"CE"
.
SC_FTRI
gives dev cards
or special victory points when a ship reaches one.
Some related methods:
hasSpecialEdges()
- does this board have any special edges?
getSpecialEdgeType(int)
- check if an edge is special
getSpecialEdges()
- get all special edges, if any
setSpecialEdge(int, int)
- set or clear an edge
clearSpecialEdges(int)
- clear all edges of one special type
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
SOCScenarioPlayerEvent
s 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:
setAddedLayoutPart(String, int[])
setAddedLayoutParts(HashMap)
SPECIAL_EDGE_TYPES
SOCPlayer.putPiece_roadOrShip_checkNewShipTradeRouteAndSpecialEdges(SOCShip, SOCBoardLarge, boolean)
SPECIAL_EDGE_DEV_CARD
.
Not many board layouts and scenarios have Special Edges, so usually hasSpecialEdges()
== false
.
public static final int SPECIAL_EDGE_SVP
"VE"
.
For more information on Special Edges, see SPECIAL_EDGE_DEV_CARD
.
public static final java.lang.String[] SPECIAL_EDGE_LAYOUT_PARTS
"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
.
public static final int[] SPECIAL_EDGE_TYPES
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].
private static final int[][] A_HEX2HEX
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.
private static final int[][] A_NODE2HEX
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.
private static final int[][] A_EDGE2HEX
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.
private static final int[][] A_EDGE2EDGE
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: | / \
private static final int[] NODE_TO_NODE_2_AWAY
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.
protected int[][] hexLayoutLg
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 : waterUnless a hex's type here isSOCBoard.WATER_HEX
1 : claySOCBoard.CLAY_HEX
2 : oreSOCBoard.ORE_HEX
3 : sheepSOCBoard.SHEEP_HEX
4 : wheatSOCBoard.WHEAT_HEX
5 : woodSOCBoard.WOOD_HEX
6 : desertSOCBoard.DESERT_HEX
7 : goldGOLD_HEX
(see its javadoc for rule) 8 : fogFOG_HEX
(see its javadoc for rule) also:MAX_LAND_HEX_LG
SOCBoard.WATER_HEX
, it's a land hex.
SOCBoard.portsLayout
protected int[] cachedGetLandHexCoords
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()
.
protected java.util.HashSet<java.lang.Integer> landHexLayout
hexLayoutLg
.
Sent from server to client, along with the land hex types / dice numbers,
via getLandHexLayout()
/ setLandHexLayout(int[])
.
protected java.util.HashSet<java.lang.Integer>[] landAreasLegalNodes
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.
protected final int maxPlayers
protected int startingLandArea
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.
protected java.util.HashSet<java.lang.Integer> legalRoadEdges
SOCBoard.nodesOnLand
.
Calculated in initLegalRoadsFromLandNodes()
, after SOCBoard.nodesOnLand
is filled by
SOCBoardLargeAtServer.makeNewBoard_fillNodesOnLandFromHexes(int[], int, int, int, boolean)
.
Used by initPlayerLegalRoads()
.
legalShipEdges
protected java.util.HashSet<java.lang.Integer> legalShipEdges
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.
legalRoadEdges
protected int[][] numberLayoutLg
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
.
private java.util.HashMap<java.lang.String,int[]> addedLayoutParts
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.
private java.util.HashMap<java.lang.Integer,java.lang.Integer> specialEdges
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.
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> fogHiddenHexes
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.
revealFogHiddenHexPrep(int)
,
revealFogHiddenHex(int, int, int)
protected java.util.HashMap<java.lang.Integer,SOCVillage> villages
dice number
and a cloth count
.
private int numCloth
SOCVillage.takeCloth(int)
returns less than the amount needed.
private int[] playerExcludedLandAreas
private int[] robberExcludedLandAreas
protected int portsCount
makeNewBoard(Map)
hasn't been called yet.
Port types, edges and facings are all stored in SOCBoard.portsLayout
.
protected int pirateHex
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
.
private int prevPirateHex
setPirateHex(rh, true)
was called.
Constructor Detail |
---|
public SOCBoardLarge(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers) throws java.lang.IllegalArgumentException
BOARDHEIGHT_LARGE
by BOARDWIDTH_LARGE
.
Only the client uses this constructor.
gameOpts
- if game has options, map of SOCGameOption
; otherwise null.maxPlayers
- Maximum players; must be 4 or 6
java.lang.IllegalArgumentException
- if maxPlayers is not 4 or 6public SOCBoardLarge(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers, IntPair boardHeightWidth) throws java.lang.IllegalArgumentException
gameOpts
- if game has options, map of SOCGameOption
; otherwise null.maxPlayers
- Maximum players; must be 4 or 6boardHeightWidth
- Board's height and width.
The constants for default size are BOARDHEIGHT_LARGE
, BOARDWIDTH_LARGE
.
java.lang.IllegalArgumentException
- if maxPlayers is not 4 or 6, or boardHeightWidth is nullMethod Detail |
---|
private static IntPair getBoardSize(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers)
BOARDHEIGHT_LARGE
by BOARDWIDTH_LARGE
,
unless gameOpts contains "_BHW" Board Height and Width.
gameOpts
- Game options, or nullmaxPlayers
- Maximum players; must be 4 or 6
SOCBoardLargeAtServer.getBoardSize(Map, int)
public void makeNewBoard(java.util.Map<java.lang.String,SOCGameOption> opts) throws java.lang.UnsupportedOperationException
setLandHexLayout(int[])
and setLegalAndPotentialSettlements(Collection, int, HashSet[])
.
Call soc.server.SOCBoardLargeAtServer.makeNewBoard instead of this stub super method.
makeNewBoard
in class SOCBoard
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()
).
java.lang.UnsupportedOperationException
- if called at clientprotected void initLegalRoadsFromLandNodes() throws java.lang.IllegalStateException
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[])
.
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 layoutinitLegalShipEdges()
public final void addLegalNodes(int[] nodes, int lan)
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()
.
nodes
- Node coordinates to add. Not checked for validity, not checked to be land not waterlan
- Land Area number to add legal nodes, or 0 to add only to Nodes On Landprotected void initLegalShipEdges()
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.
initPlayerLegalShips()
,
initLegalRoadsFromLandNodes()
public int revealFogHiddenHexPrep(int hexCoord) throws java.lang.IllegalArgumentException
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.
hexCoord
- Coordinate of the hex to reveal
final int hexType = encodedHexInfo >> 8; int diceNum = encodedHexInfo & 0xFF; if (diceNum == 0xFF) diceNum = 0;hexType is the same type of value as
getHexTypeFromCoord(int)
.
java.lang.IllegalArgumentException
- if hexCoord isn't currently a FOG_HEX
SOCGame.revealFogHiddenHex(int, int, int)
void revealFogHiddenHex(int hexCoord, int hexType, int diceNum) throws java.lang.IllegalArgumentException
SOCGame.revealFogHiddenHex(int, int, int)
before updating player legal ship edges.
hexCoord
- Coordinate of the hex to revealhexType
- Revealed hex type, same value as getHexTypeFromCoord(int)
diceNum
- Revealed hex dice number, same value as getNumberOnHexFromCoord(int)
, or 0
java.lang.IllegalArgumentException
- if hexCoord isn't currently a FOG_HEX
revealFogHiddenHexPrep(int)
@Deprecated public int[] getHexLayout() throws java.lang.UnsupportedOperationException
getLandHexCoords()
instead.
For sending a SOCBoardLayout2 message, call getLandHexLayout()
instead.
getHexLayout
in class SOCBoard
SOCBoard.hexLayout
.
Please treat the returned array as read-only.
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.SOCBoard.getHexLayout()
@Deprecated public void setHexLayout(int[] hl) throws java.lang.UnsupportedOperationException
setLandHexLayout(int[])
instead.
setHexLayout
in class SOCBoard
hl
- the hex layout
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.SOCBoard.setHexLayout(int[])
@Deprecated public int[] getNumberLayout() throws java.lang.UnsupportedOperationException
getLandHexCoords()
and getNumberOnHexFromCoord(int)
instead.
getNumberLayout
in class SOCBoard
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.SOCBoard.getNumberLayout()
@Deprecated public void setNumberLayout(int[] nl) throws java.lang.UnsupportedOperationException
setLandHexLayout(int[])
instead.
setNumberLayout
in class SOCBoard
nl
- the number layout, from getNumberLayout()
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.SOCBoard.setNumberLayout(int[])
public java.util.HashMap<java.lang.String,int[]> getAddedLayoutParts()
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
.
getAddedLayoutPart(String)
,
setAddedLayoutPart(String, int[])
public int[] getAddedLayoutPart(java.lang.String key)
getAddedLayoutParts()
.
The layout part keys are documented at SOCBoardLayout2
.
key
- Key name (short and uppercase)
public void setAddedLayoutParts(java.util.HashMap<java.lang.String,int[]> adds)
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.
adds
- Added parts, or null if nonesetAddedLayoutPart(String, int[])
public void setAddedLayoutPart(java.lang.String key, int[] v)
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"
.
key
- Key name (short and uppercase)v
- Value (typically a list of coordinates)setAddedLayoutParts(HashMap)
public java.lang.Integer drawItemFromStack() throws java.lang.UnsupportedOperationException
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.
null
if empty or unused
java.lang.UnsupportedOperationException
- if called at clientvoid placePort(int ptype, int edge) throws java.lang.IllegalArgumentException
_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
.
ptype
- The type of port (in range MISC_PORT
to WOOD_PORT
)edge
- An available coastal edge
java.lang.IllegalArgumentException
- if edge
is between 2 land hexes or 2 water hexespublic int movePirateHexAlongPath(int numSteps) throws java.lang.UnsupportedOperationException, java.lang.IllegalStateException
_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.
numSteps
- Number of steps to move along the path
java.lang.UnsupportedOperationException
- if called at client
java.lang.IllegalStateException
- if this board doesn't have layout part "PP" for the Pirate Path.public void setPirateHex(int ph, boolean rememberPrevious) throws java.lang.IllegalArgumentException
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
.
ph
- the new pirate hex coordinate, or 0 to take the pirate off the board;
must be >= 0, not validated beyond thatrememberPrevious
- Should we remember the old pirate hex?
java.lang.IllegalArgumentException
- if ph < 0getPirateHex()
,
getPreviousPirateHex()
,
SOCBoard.setRobberHex(int, boolean)
public int getPirateHex()
getPreviousPirateHex()
,
SOCBoard.getRobberHex()
public int getPreviousPirateHex()
setPirateHex(int, boolean)
where rememberPrevious == true, get the previous coordinate
of the pirate.
getPirateHex()
public int[] getPlayerExcludedLandAreas()
setPlayerExcludedLandAreas(int[])
,
getRobberExcludedLandAreas()
public void setPlayerExcludedLandAreas(int[] px)
px
- Land area numbers, or null if nonegetPlayerExcludedLandAreas()
,
setRobberExcludedLandAreas(int[])
public int[] getRobberExcludedLandAreas()
setRobberExcludedLandAreas(int[])
,
getPlayerExcludedLandAreas()
public void setRobberExcludedLandAreas(int[] rx)
rx
- Land area numbers, or null if nonegetRobberExcludedLandAreas()
,
setPlayerExcludedLandAreas(int[])
public int getNumberOnHexFromCoord(int hex)
getNumberOnHexFromCoord
in class SOCBoard
hex
- the coordinates for a hex
SOCBoard.getNumberOnHexFromNumber(int)
public int getNumberOnHexFromNumber(int hex)
getNumberOnHexFromNumber
in class SOCBoard
hex
- the coordinates for a hex, or -1 if invalid
SOCBoard.getNumberOnHexFromCoord(int)
@Deprecated public int getHexNumFromCoord(int hexCoord) throws java.lang.UnsupportedOperationException
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.
getHexNumFromCoord
in class SOCBoard
hexCoord
- the coordinates ("ID") for a hex
java.lang.UnsupportedOperationException
- since the board encoding doesn't support this methodgetHexTypeFromCoord(int)
public int getHexTypeFromCoord(int 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.
getHexTypeFromCoord
in class SOCBoard
hex
- the coordinates ("ID") for a hex
SOCBoard.CLAY_HEX
to SOCBoard.WOOD_HEX
,
SOCBoard.DESERT_HEX
, GOLD_HEX
, FOG_HEX
,
or SOCBoard.WATER_HEX
.
Invalid hex coordinates return -1.getLandHexCoords()
public int getHexTypeFromNumber(int hex)
Unlike the original SOCBoard
encoding, port types are not
encoded in the hex layout; use SOCBoard.getPortTypeFromNodeCoord(int)
instead.
getHexTypeFromNumber
in class SOCBoard
hex
- the number of a hex, or -1 for invalid
SOCBoard.CLAY_HEX
to SOCBoard.WOOD_HEX
,
SOCBoard.DESERT_HEX
, GOLD_HEX
, FOG_HEX
,
or SOCBoard.WATER_HEX
.
Invalid hex numbers return -1.getHexTypeFromCoord(int)
public SOCVillage getVillageAtNode(int nodeCoord)
nodeCoord
- Node coordinate
getVillages()
public final boolean isEdgeCoastline(int edge)
FOG_HEX
is considered land here.
edge
- Edge coordinate, not checked for validity
isHexCoastline(int)
,
isNodeCoastline(int)
,
getAdjacentEdgesToNode_coastal(int)
public java.util.HashSet<java.lang.Integer> getLandHexCoordsSet()
Integer
spublic int[] getLandHexCoords()
Before v2.0.00, this was getHexLandCoords().
getLandHexCoords
in class SOCBoard
getLandHexCoordsSet()
public void putPiece(SOCPlayingPiece pp)
Except for SOCVillage
, call
pl.putPiece(pp)
for each player before calling this method.
putPiece
in class SOCBoard
pp
- Piece to place on the board; coordinates are not checked for validitySOCBoard.removePiece(SOCPlayingPiece)
public void addLoneLegalSettlements(SOCGame ga, int[] ls) throws java.lang.IllegalArgumentException
_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.
ga
- Game, to get players; SOCBoard
doesn't keep a reference to its gamels
- 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.
java.lang.IllegalArgumentException
- if ls.length
!= ga.maxPlayers
public boolean hasSpecialEdges()
public int getSpecialEdgeType(int edge)
edge
- Edge coordinate
SPECIAL_EDGE_DEV_CARD
or
or SPECIAL_EDGE_SVP
, or 0 if the edge isn't special or
isn't a valid edge.getSpecialEdges()
,
setSpecialEdge(int, int)
,
setSpecialEdges(int[], int)
,
clearSpecialEdges(int)
public java.util.Iterator<java.util.Map.Entry<java.lang.Integer,java.lang.Integer>> getSpecialEdges()
SPECIAL_EDGE_DEV_CARD
getSpecialEdgeType(int)
public void setSpecialEdge(int edge, int seType)
seType
.
edge
- Edge coordinateseType
- A special edge type code such as SPECIAL_EDGE_DEV_CARD
or
or SPECIAL_EDGE_SVP
, or 0 if the edge isn't specialpublic void setSpecialEdges(int[] edges, int seType)
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.
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).public void clearSpecialEdges(int seType)
seType
- A special edge type code such as SPECIAL_EDGE_DEV_CARD
or
or SPECIAL_EDGE_SVP
. 0 is ignored.public int[] getVillageAndClothLayout()
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.
setVillageAndClothLayout(int[])
,
getVillages()
public void setVillageAndClothLayout(int[] villageNodesAndDice) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
makeNewBoard(Map)
, with the Cloth Village
scenario,
create SOCVillage
s at these node locations. Adds to villages
.
Also set the board's "general supply" of cloth (setCloth(int)
).
villageNodesAndDice
- Starting cloth count and each village's node coordinate and dice number,
grouped in pairs, from getVillageAndClothLayout()
.
java.lang.NullPointerException
- if array null
java.lang.IllegalArgumentException
- if array length odd or < 4public java.util.HashMap<java.lang.Integer,SOCVillage> getVillages()
SOCVillage
s on the board, for scenario game option SOCGameOption.K_SC_CLVI
.
Treat the returned data as read-only.
getVillageAtNode(int)
,
getVillageAndClothLayout()
,
getCloth()
public int getCloth()
SOCVillage.takeCloth(int)
returns less than the amount needed.
takeCloth(int)
,
distributeClothFromRoll(SOCGame, int)
,
getVillageAtNode(int)
public void setCloth(int numCloth)
numCloth
- Number of clothpublic int takeCloth(int numTake)
numTake
- Number of cloth to try and take
getCloth()
,
distributeClothFromRoll(SOCGame, int)
,
SOCVillage.takeCloth(int)
public int[] distributeClothFromRoll(SOCGame game, int dice)
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.
game
- Game with this boarddice
- Rolled dice number
public boolean isHexOnLand(int hexCoord)
isHexOnLand
in class SOCBoard
hexCoord
- Hex coordinate, within the board's bounds
isHexOnWater(int)
,
isHexCoastline(int)
public boolean isHexOnWater(int hexCoord)
isHexOnWater
in class SOCBoard
hexCoord
- Hex coordinate, within the board's bounds
isHexOnLand(int)
,
isHexCoastline(int)
public boolean isHexCoastline(int hexCoord) throws java.lang.IllegalArgumentException
FOG_HEX
is considered land here.
hexCoord
- Hex coordinate, within the board's bounds
java.lang.IllegalArgumentException
- if hexCoord is water or not a valid hex coordinateisEdgeCoastline(int)
,
isNodeCoastline(int)
public boolean isHexInLandAreas(int hexCoord, int[] las)
hexCoord
- The hex coordinate, within the board's boundslas
- List of land area numbers, or null for an empty list
getLandAreasLegalNodes()
is nullisHexOnLand(int)
public boolean isNodeInLandAreas(int nodeCoord, int[] las)
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)
.
nodeCoord
- The node's coordinatelas
- List of land area numbers, or null for an empty list
getNodeLandArea(nodeCoord)
;
false otherwise, or if getLandAreasLegalNodes()
is nullpublic int getNodeLandArea(int nodeCoord)
nodeCoord
- the node's coordinate
getLandAreasLegalNodes()
is null,
always returns 1 if isNodeOnLand(nodeCoord)
.getLandAreasLegalNodes()
,
isNodeInLandAreas(int, int[])
public final boolean isNodeCoastline(int node)
FOG_HEX
is considered land here.
node
- Node coordinate, not checked for validity
isEdgeCoastline(int)
,
isHexCoastline(int)
,
getAdjacentEdgesToNode_coastal(int)
public int[] getLandHexLayout()
SOCBoard.SHEEP_HEX
), Dice Number (-1 for desert).
setLandHexLayout(int[])
public void setLandHexLayout(int[] lh)
After calling this, please call
game.setPlayersLandHexCoordinates()
.
After makeNewBoard(Map)
calculates the potential/legal settlements,
call each player's SOCPlayer.setPotentialAndLegalSettlements(Collection, boolean, HashSet[])
.
lh
- the layout, or null if no land hexes, from getLandHexLayout()
public int getStartingLandArea()
This is enforced during makeNewBoard(Map)
, by using
that land area for the only initial potential/legal settlement locations.
getLandAreasLegalNodes()
.
0 if players can start anywhere and/or
landAreasLegalNodes == null.SOCPlayer.getStartingLandAreasEncoded()
public java.util.HashSet<java.lang.Integer>[] getLandAreasLegalNodes()
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.
getNodeLandArea(int)
public java.util.HashSet<java.lang.Integer> getLegalAndPotentialSettlements()
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.
public void setLegalAndPotentialSettlements(java.util.Collection<java.lang.Integer> psNodes, int sla, java.util.HashSet<java.lang.Integer>[] lan) throws java.lang.IllegalStateException
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.
psNodes
- The set of potential settlement node coordinates as Integer
s;
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 0lan
- If non-null, all Land Areas' legal node coordinates.
Index 0 is ignored; land area numbers start at 1.
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.java.util.HashSet<java.lang.Integer> initPlayerLegalRoads()
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[])
.
initPlayerLegalRoads
in class SOCBoard
Integer
sjava.util.HashSet<java.lang.Integer> initPlayerLegalShips()
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[])
.
Integer
spublic java.util.Vector<java.lang.Integer> getAdjacentHexesToHex(int hexCoord, boolean includeWater)
SOCBoard.getBoardHeight()
, SOCBoard.getBoardWidth()
).
Coordinate offsets - adjacent hexes to hex:
(-2,-1) (-2,+1) (0,-2) x (0,+2) (+2,-1) (+2,+1)
getAdjacentHexesToHex
in class SOCBoard
hexCoord
- Coordinate ("ID") of this hex; not checked for validityincludeWater
- Should water hexes be returned (not only land ones)?
isHexAdjacentToHex(int, int)
,
isHexInBounds(int, int)
,
isHexCoastline(int)
private final void getAdjacentHexes2Hex_AddIfOK(java.util.Vector<java.lang.Integer> addTo, boolean includeWater, int r, int c)
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 coordinatec
- Hex column coordinatepublic boolean isHexAdjacentToHex(int hex1Coord, int hex2Coord)
hex1Coord
- First hex coordinate; not checked for validityhex2Coord
- Second hex coordinate; not checked for validity
getAdjacentHexesToHex(int, boolean)
public int[] getAdjacentEdgesToHex(int hexCoord)
hexCoord
- Coordinate of this hex; not checked for validity
public boolean isEdgeAdjacentToHex(int edgeCoord, int hexCoord)
edgeCoord
- Coordinate of the edge; not checked for validityhexCoord
- Hex coordinate; not checked for validity
public int getAdjacentNodeToHex(int hexCoord, int dir) throws java.lang.IllegalArgumentException
getAdjacentNodeToHex
in class SOCBoard
hexCoord
- Coordinate ("ID") of this hexdir
- Direction, clockwise from top (northern point of hex):
0 is north, 1 is northeast, etc, 5 is northwest.
java.lang.IllegalArgumentException
- if dir < 0 or dir > 5public int[] getAdjacentNodesToHex(int hexCoord)
getAdjacentNodesToHex
in class SOCBoard
hexCoord
- Coordinate of this hex; not checked for validity
getAdjacentNodeToHex(int, int)
public int getAdjacentHexToEdge(int edgeCoord, int facing) throws java.lang.IllegalArgumentException
getAdjacentHexToEdge
in class SOCBoard
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.
java.lang.IllegalArgumentException
- if facing < 1 or facing > 6getAdjacentHexesToEdge_arr(int)
,
getAdjacentHexesToEdgeEnds(int)
public int[] getAdjacentHexesToEdge_arr(int edgeCoord) throws java.lang.IllegalArgumentException
edgeCoord
- The edge's coordinate. Not checked for validity.
java.lang.IllegalArgumentException
getAdjacentHexToEdge(int, int)
,
getAdjacentHexesToEdgeEnds(int)
public int[] getAdjacentHexesToEdgeEnds(int edgeCoord) throws java.lang.IllegalArgumentException
edgeCoord
- The edge's coordinate. Not checked for validity.
java.lang.IllegalArgumentException
getAdjacentHexToEdge(int, int)
,
getAdjacentHexesToEdge_arr(int)
public java.util.Vector<java.lang.Integer> getAdjacentEdgesToEdge(int coord)
getAdjacentEdgesToEdge
in class SOCBoard
coord
- Edge coordinate; not checked for validity
coord
is off the board, none of its adjacents will be in bounds,
and this method will return an empty list; never returns null
.public int getAdjacentNodeToEdge(int edgeCoord, int facing) throws java.lang.IllegalArgumentException
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
.
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.)getAdjacentNodesToEdge(int)
public java.util.Vector<java.lang.Integer> getAdjacentNodesToEdge(int coord)
getAdjacentNodesToEdge
in class SOCBoard
getAdjacentNodesToEdge_arr(int)
,
getAdjacentNodeToEdge(int, int)
public int[] getAdjacentNodesToEdge_arr(int coord)
getAdjacentNodesToEdge_arr
in class SOCBoard
coord
- Edge coordinate; not checked for validity
getAdjacentNodesToEdge(int)
,
getAdjacentNodeToEdge(int, int)
,
getNodeBetweenAdjacentEdges(int, int)
public int getNodeBetweenAdjacentEdges(int edgeA, int edgeB) throws java.lang.IllegalArgumentException
Does not check actual settlements or other pieces on the board.
edgeA
- Edge coordinate adjacent to edgeB; not checked for validityedgeB
- Edge coordinate adjacent to edgeA; not checked for validity
java.lang.IllegalArgumentException
- if edgeA and edgeB aren't adjacentgetAdjacentNodesToEdge(int)
public java.util.Vector<java.lang.Integer> getAdjacentHexesToNode(int nodeCoord)
getAdjacentHexesToNode
in class SOCBoard
nodeCoord
- Node coordinate. Is not checked for validity.
public int getAdjacentEdgeToNode(int nodeCoord, int nodeDir) throws java.lang.IllegalArgumentException
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.
getAdjacentEdgeToNode
in class SOCBoard
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
java.lang.IllegalArgumentException
- if nodeDir is less than 0 or greater than 2SOCBoard.getAdjacentEdgesToNode(int)
,
getEdgeBetweenAdjacentNodes(int, int)
,
getAdjacentNodeToNode(int, int)
public int getEdgeBetweenAdjacentNodes(int nodeA, int nodeB)
Does not check actual roads or other pieces on the board.
getEdgeBetweenAdjacentNodes
in class SOCBoard
nodeA
- Node coordinate adjacent to nodeB; not checked for validitynodeB
- Node coordinate adjacent to nodeA; not checked for validity
SOCBoard.getAdjacentEdgesToNode(int)
,
getAdjacentEdgeToNode(int, int)
public boolean isEdgeAdjacentToNode(int nodeCoord, int edgeCoord)
isEdgeAdjacentToNode
in class SOCBoard
nodeCoord
- Node coordinate; not bounds-checkededgeCoord
- Edge coordinate; bounds-checked against board boundaries.
getEdgeBetweenAdjacentNodes(int, int)
public final java.util.List<java.lang.Integer> getAdjacentEdgesToNode_coastal(int node)
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.
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.
node
, or an empty list if noneisEdgeCoastline(int)
,
isNodeCoastline(int)
public int getAdjacentNodeToNode(int nodeCoord, int nodeDir) throws java.lang.IllegalArgumentException
getAdjacentNodeToNode
in class SOCBoard
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
java.lang.IllegalArgumentException
- if nodeDir is less than 0 or greater than 2SOCBoard.getAdjacentNodesToNode(int)
,
getAdjacentNodeToNode2Away(int, int)
,
getAdjacentEdgeToNode(int, int)
,
SOCBoard.isNodeAdjacentToNode(int, int)
public int getAdjacentEdgeToNode2Away(int node, int node2away)
getAdjacentEdgeToNode2Away
in class SOCBoard
node
- Initial node coordinate; not validatednode2away
- Second node coordinate; should be 2 away,
but this is not validated
getAdjacentNodeToNode2Away(int, int)
public int getAdjacentNodeToNode2Away(int nodeCoord, int facing) throws java.lang.IllegalArgumentException
SOCBoard.FACING_NE
is 1,
SOCBoard.FACING_E
is 2, etc; SOCBoard.FACING_NW
is 6.
getAdjacentNodeToNode2Away
in class SOCBoard
nodeCoord
- Starting node's coordinatefacing
- 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.
on the board
.
java.lang.IllegalArgumentException
- if facing < 1 or facing > 6getAdjacentNodeToNode(int, int)
,
getAdjacentEdgeToNode2Away(int, int)
,
isNode2AwayFromNode(int, int)
public boolean isNode2AwayFromNode(int n1, int n2)
isNode2AwayFromNode
in class SOCBoard
n1
- Node coordinate; not validatedn2
- Node coordinate; not validated
getAdjacentNodeToNode2Away(int, int)
public final boolean isHexInBounds(int r, int c)
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)getAdjacentHexesToHex(int, boolean)
,
isHexAtBoardMargin(int)
public final boolean isHexAtBoardMargin(int hexCoord)
hexCoord
- Hex coordinate; not validity-checkedisHexInBounds(int, int)
public final boolean isNodeInBounds(int r, int c)
r
- Node coordinate's rowc
- Node coordinate's columnisHexInBounds(int, int)
,
isEdgeInBounds(int, int)
,
SOCBoard.isNodeOnLand(int)
public final boolean isEdgeInBounds(int r, int c)
r
- Edge coordinate's rowc
- Edge coordinate's columnisHexInBounds(int, int)
,
isNodeInBounds(int, int)
public int getPortsCount()
SOCBoard
SOCBoard.BOARD_ENCODING_LARGE
) has a varying amount of ports,
set during SOCBoard.makeNewBoard(Map)
.
getPortsCount
in class SOCBoard
SOCBoard.makeNewBoard(Map)
hasn't been called yet.public void setPortsLayout(int[] portTypesAndInfo)
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.
setPortsLayout
in class SOCBoard
SOCBoard.getPortsLayout()
public int[] getPortsEdges()
SOCBoard
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.
getPortsEdges
in class SOCBoard
SOCBoard.getPortsFacing()
,
SOCBoard.getPortCoordinates(int)
public int[] getPortsFacing()
SOCBoard
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.
getPortsFacing
in class SOCBoard
SOCBoard.getPortsEdges()
public int getPortEdgeFromNode(int node)
node
- Node coordinate. If coordinate is not valid, it won't have a port.
public int getPortFacingFromEdge(int edge) throws java.lang.IllegalArgumentException
edge
's adjacent hexes for land and water;
if a hex is off the edge of the board, it's considered water.
edge
- A coastal edge; not validated here, must be a possible coordinate for an edge
FACING_NE
,
FACING_E
, ... FACING_NW
java.lang.IllegalArgumentException
- if edge
is between 2 land hexes or 2 water hexespublic boolean canRemovePort(int edge)
_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.
edge
- Port's edge coordinate
removePort(int)
,
SOCGame.canRemovePort(SOCPlayer, int)
,
SOCGame.canPlacePort(SOCPlayer, int)
public int removePort(int edge) throws java.lang.IllegalArgumentException
_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.
edge
- A port edge to be removed
MISC_PORT
to WOOD_PORT
)
java.lang.IllegalArgumentException
- if edge
not found in port layoutSOCGame.removePort(SOCPlayer, int)
,
SOCGame.placePort(SOCPlayer, int, int)
public java.lang.String edgeCoordToString(int edge)
edgeCoordToString
in class SOCBoard
getNumberOnHexFromCoord(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |