public class Board
extends java.lang.Object
implements org.json.JSONString
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BOARD_GENERATION_DIRECTORY
Location of files for board generation
|
Game |
game
The game for this board.
|
long |
seed
The random seed from which this Board was generated:
-1 if loaded from a non-random file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allTrucksAreAtDepot()
Return true iff all alive Trucks in this board are currently on the Truck Depot node.
|
Edge[] |
getAIntersection()
Return a 2x1 array of edges that have lines that intersect.
|
int |
getDropoffCost()
Return the one-time cost incurred when a truck drops off a parcel.
|
java.util.HashSet<Edge> |
getEdges()
Return the set of Edges in this board.
|
int |
getEdgesSize()
Return the number of Edges in this board.
|
int |
getMaxLength()
Return the maximum length of all edges on the board.
|
int |
getMinLength()
Return the minimum length of all edges on the board.
|
Node |
getNode(java.lang.String name)
Return the Node named
name in this board if it exists, null otherwise. |
java.util.HashSet<Node> |
getNodes()
Return a HashSet containing all the Nodes in this board.
|
int |
getNodesSize()
Return the number of Nodes in this board
|
int |
getOnColorMultiplier()
Return the score multiplier of successfully delivering a parcel using the
correct color of Truck.
|
java.util.Set<Parcel> |
getParcels()
Return the parcels in this board that have not yet been delivered.
|
int |
getPayoff()
Return the value of successfully delivering one parcel to its final destination.
|
int |
getPickupCost()
Return the one-time cost incurred when a truck picks up a parcel.
|
Edge |
getRandomEdge()
Return a random edge in this board
|
Node |
getRandomNode()
Return a random node in this board
|
Node |
getTruckDepot()
Return the unique Truck Depot Node in this board, to which
Trucks must return before the game can be ended.
|
java.util.ArrayList<Truck> |
getTrucks()
Return the trucks on this board.
|
java.util.ArrayList<Truck> |
getTrucksOnDepot()
Return the alive trucks on this board that are currently on Truck Depot node
(an empty arrayList if there are no such trucks).
|
int |
getWaitCost()
The score cost of idling for a frame, per truck.
|
boolean |
isIntersection()
Return true iff there is any intersection of the lines drawn by the
edges in edges.
|
boolean |
isTruckDepot()
Return true iff an alive Truck in this board is currently on the Truck Depot node.
|
static Board |
randomBoard(Game g)
Return a new random board for g seeded via random seed.
|
static Board |
randomBoard(Game g,
long seed)
Return a new random board for g seeded with
seed . |
java.lang.String |
toJSONString()
Return a JSON-compliant version of toString().
|
java.lang.String |
toString()
Return a String representation of this board, including edges and nodes.
|
void |
updateMinMaxLength()
Update the Minimum and Maximum lengths of all edge instances.
|
public final long seed
public final Game game
public static final java.lang.String BOARD_GENERATION_DIRECTORY
public Node getRandomNode()
public Edge getRandomEdge()
public java.util.HashSet<Node> getNodes()
public int getNodesSize()
public Node getNode(java.lang.String name)
name
in this board if it exists, null otherwise.public Node getTruckDepot()
public java.util.ArrayList<Truck> getTrucks()
public java.util.ArrayList<Truck> getTrucksOnDepot()
public boolean isTruckDepot()
public boolean allTrucksAreAtDepot()
public java.util.Set<Parcel> getParcels()
public java.util.HashSet<Edge> getEdges()
public int getEdgesSize()
public boolean isIntersection()
public void updateMinMaxLength()
public int getMaxLength()
public int getMinLength()
public Edge[] getAIntersection()
public int getWaitCost()
public int getPickupCost()
public int getDropoffCost()
public int getPayoff()
public int getOnColorMultiplier()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toJSONString()
toJSONString
in interface org.json.JSONString
public static Board randomBoard(Game g)