Class HROTDeadlyEnemies
java.lang.Object
application.model.rules.Rule
application.model.rules.RuleFamily
application.model.rules.hrot.BaseHROT
application.model.rules.hrot.HROT
application.model.rules.hrot.enemies.HROTDeadlyEnemies
- All Implemented Interfaces:
ApgtableGeneratable
,MinMaxRuleable
,java.lang.Cloneable
public class HROTDeadlyEnemies extends HROT implements ApgtableGeneratable
Represents a HROT DeadlyEnemies rule where opposite states mutually stablise each other.
-
Field Summary
Fields inherited from class application.model.rules.hrot.HROT
birth, maxNeighbourhoodCount, survival
Fields inherited from class application.model.rules.hrot.BaseHROT
hrotTransitions, neighbourhood, neighbourhoodRegex, weights
Fields inherited from class application.model.rules.Rule
alternatingPeriod, background, boundedGrid, numStates, readingOrder, tiling
-
Constructor Summary
Constructors Constructor Description HROTDeadlyEnemies()
Creates a HROT DeadlyEnemies rule with the rule Minibugs DeadlyEnemiesHROTDeadlyEnemies(java.lang.String rulestring)
Creates a HROT DeadlyEnemies rule with the specified rulestring -
Method Summary
Modifier and Type Method Description java.lang.String
canonise(java.lang.String rulestring)
Canonises the inputted rulestring with the currently loaded parameters.java.lang.Object
clone()
Clones the ruleprotected void
fromRulestring(java.lang.String rulestring)
Loads the rule's parameters from a rulestringRuleDirective[]
generateApgtable()
Generates an apgtable for apgsearch to usejava.lang.String
getDescription()
Returns a plain text description of the HROT DeadlyEnemies rule family to be displayed in the Rule Dialogjava.lang.String[]
getRegex()
The regexes that will match a valid rulestringint
transitionFunc(int[] neighbours, int cellState, int generations, Coordinate coordinate)
This method represents the transition function of the ruleMethods inherited from class application.model.rules.hrot.HROT
betweenMinMax, getBirth, getMinMaxRule, getName, getSurvival, randomise, setBirth, setSurvival, updateBackground, validMinMax
Methods inherited from class application.model.rules.hrot.BaseHROT
generateComments, getNeighbourhood, getNeighbourhoodSpecifier, getRuleInfo, getWeights, loadComments, loadNeighbourhood, setNeighbourhood, setWeights
Methods inherited from class application.model.rules.RuleFamily
equals, getName, getNeighbourList, getRulestring, hashCode, setRulestring, toString
Methods inherited from class application.model.rules.Rule
convertState, dependsOnNeighbours, getAlternatingPeriod, getBoundedGrid, getColour, getNeighbourhood, getNumStates, getTiling, setBackground, setBoundedGrid, setReadingOrder, step
-
Constructor Details
-
HROTDeadlyEnemies
public HROTDeadlyEnemies()Creates a HROT DeadlyEnemies rule with the rule Minibugs DeadlyEnemies -
HROTDeadlyEnemies
public HROTDeadlyEnemies(java.lang.String rulestring)Creates a HROT DeadlyEnemies rule with the specified rulestring- Parameters:
rulestring
- The rulestring of the DeadlyEnemies rule
-
-
Method Details
-
fromRulestring
protected void fromRulestring(java.lang.String rulestring) throws java.lang.IllegalArgumentExceptionLoads the rule's parameters from a rulestring- Overrides:
fromRulestring
in classHROT
- Parameters:
rulestring
- The rulestring of the HROT DeadlyEnemies rule (eg. B3/S23DeadlyEnemies, R2,C2,S6-9,B7-8,NMDeadlyEnemies)- Throws:
java.lang.IllegalArgumentException
- Thrown if an invalid rulestring is passed in
-
canonise
public java.lang.String canonise(java.lang.String rulestring)Canonises the inputted rulestring with the currently loaded parameters. -
getRegex
public java.lang.String[] getRegex()The regexes that will match a valid rulestring -
getDescription
public java.lang.String getDescription()Returns a plain text description of the HROT DeadlyEnemies rule family to be displayed in the Rule Dialog- Overrides:
getDescription
in classHROT
- Returns:
- Description of the HROT DeadlyEnemies rule family
-
generateApgtable
Generates an apgtable for apgsearch to use- Specified by:
generateApgtable
in interfaceApgtableGeneratable
- Overrides:
generateApgtable
in classHROT
- Returns:
- True if the operation was successful, false otherwise
-
transitionFunc
Description copied from class:Rule
This method represents the transition function of the rule- Overrides:
transitionFunc
in classHROT
- Parameters:
neighbours
- The cell's neighbours in the order of the neighbourhood providedcellState
- The current state of the cellgenerations
- The current generation of the simulationcoordinate
- The coordinate of the cell- Returns:
- The state of the cell in the next generation
-
clone
public java.lang.Object clone()Description copied from class:HROT
Clones the rule
-