public class RandomMapGenerator extends java.lang.Object implements LuxMapGenerator
Constructor and Description |
---|
RandomMapGenerator() |
Modifier and Type | Method and Description |
---|---|
boolean |
canCache()
Is Lux allowed to create and cache maps from this generator.
|
java.lang.String |
description()
A description of your generator.
|
boolean |
generate(java.io.PrintWriter out,
java.lang.String choice,
int seed,
MapLoader loader)
Generate a map of the given 'choice' and output it to the given PrintWriter.
|
void |
generateBoard()
The main method that controls the generation of a map.
|
void |
generateNextShapeAroundPoint(double pointx,
double pointy)
Generate the next country shape around the given point.
|
java.util.List |
getChoices()
Return a List of Strings giving the different map styles this generator can do.
|
static int |
getHeightForSize(java.lang.String boardSize) |
java.awt.geom.Point2D |
getMiddlePoint(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Returns the point in between pa and p2.
|
int |
getScenarioPlayerCountForSize(java.lang.String boardSize) |
static int |
getWidthForSize(java.lang.String boardSize) |
boolean |
lineCanExistBetween(int s1,
int s2)
Tests to see if a line can safely be drawn between the two shapes.
|
java.lang.String |
message(java.lang.String message,
java.lang.Object data)
This method is not currently used.
|
java.lang.String |
name()
A name for your generator.
|
double |
nearNumber(double near)
Return a random number near to 'near', depending on the class-variable 'variance'.
|
boolean |
saveBoard(java.io.PrintWriter file,
java.lang.String mapName) |
float |
version()
The version of your generator.
|
public boolean canCache()
LuxMapGenerator
canCache
in interface LuxMapGenerator
public java.lang.String description()
LuxMapGenerator
description
in interface LuxMapGenerator
public boolean generate(java.io.PrintWriter out, java.lang.String choice, int seed, MapLoader loader)
LuxMapGenerator
void print(String s)
void println(String s)
The given MapLoader has two methods of interest.
void setLoadText(String text) - will display words where the board will go when not using a cached-map.
static String getMapGeneratorPath() - can be used to obtain the folder path of where MapGenerators are stored on the local filesystem.
This method should return true on success. If an error ocurs then false should be returned and a message to stdout should be printed.
generate
in interface LuxMapGenerator
PrintWriter
,
MapLoader
public void generateBoard()
public void generateNextShapeAroundPoint(double pointx, double pointy)
public java.util.List getChoices()
LuxMapGenerator
public List getChoices() { if (choices == null) { choices = new Vector(); choices.add("tiny"); choices.add("small"); choices.add("medium"); choices.add("large"); choices.add("huge"); } return choices; }
getChoices
in interface LuxMapGenerator
List
public static int getHeightForSize(java.lang.String boardSize)
public java.awt.geom.Point2D getMiddlePoint(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
public int getScenarioPlayerCountForSize(java.lang.String boardSize)
public static int getWidthForSize(java.lang.String boardSize)
public boolean lineCanExistBetween(int s1, int s2)
public java.lang.String message(java.lang.String message, java.lang.Object data)
LuxMapGenerator
message
in interface LuxMapGenerator
public java.lang.String name()
LuxMapGenerator
name
in interface LuxMapGenerator
public double nearNumber(double near)
public boolean saveBoard(java.io.PrintWriter file, java.lang.String mapName)
public float version()
LuxMapGenerator
version
in interface LuxMapGenerator