Package application.model.patterns
Class PowerLawPattern
java.lang.Object
application.model.simulation.Grid
application.model.simulation.Simulator
application.model.patterns.Pattern
application.model.patterns.PowerLawPattern
public class PowerLawPattern extends Pattern
Represents a pattern whose average population follows a power law.
Essentially apgsearch's zz_REPLICATOR, zz_LINEAR, zz_EXPLOSIVE and zz_QUADRATIC.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PowerLawPattern(Rule rule, Grid pattern, double power)
Constructs a power law pattern with the specified growth rate -
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
additionalInfo()
static double
regress(java.util.ArrayList<org.javatuples.Pair<java.lang.Double,java.lang.Double>> pointList)
Finds the gradient of a list of points.java.lang.String
toString()
Methods inherited from class application.model.patterns.Pattern
compareString, getMaxRule, getMinRule, getName, setMaxRule, setMinRule, setPhases
Methods inherited from class application.model.simulation.Simulator
clearCells, getCellsChanged, getGeneration, getRule, identify, identify, identify, setCell, setCell, setGeneration, setRule, step, step, toRLE
Methods inherited from class application.model.simulation.Grid
addBlock, bfs, clearCells, convertCell, deepCopy, equals, fromApgcode, fromRLE, getBackground, getBlock, getBlockCoordinate, getBlockCoordinates, getBlocks, getBounds, getCell, getCell, getCells, getPopulation, hashCode, hashCode, hashCode, hasNext, insertCells, iterateCells, iterateCellsInBlock, iterator, next, reflectCellsX, reflectCellsY, removeBlock, rotateCCW, rotateCW, setBackground, shallowCopy, size, slowEquals, toArray, toRLE, updateBounds
-
Constructor Details
-
PowerLawPattern
Constructs a power law pattern with the specified growth rate- Parameters:
rule
- The rule that the pattern works inpattern
- The power law patternpower
- The pattern's growth rate
-
-
Method Details
-
toString
public java.lang.String toString() -
additionalInfo
public java.util.Map<java.lang.String,java.lang.String> additionalInfo()- Specified by:
additionalInfo
in classPattern
-
regress
public static double regress(java.util.ArrayList<org.javatuples.Pair<java.lang.Double,java.lang.Double>> pointList)Finds the gradient of a list of points. Totally not stolen from apgsearch 1.x.- Parameters:
pointList
- The list of points- Returns:
- Returns the gradient of the list of points
-