Class HROTSymbiosis

All Implemented Interfaces:
ApgtableGeneratable, MinMaxRuleable, java.lang.Cloneable

public class HROTSymbiosis
extends HROT
implements ApgtableGeneratable
Represents a HROT Symbiosis rule where opposite states mutually stablise each other.
  • Constructor Details

    • HROTSymbiosis

      public HROTSymbiosis()
      Creates a HROT Symbiosis rule with the rule Minibugs Symbiosis
    • HROTSymbiosis

      public HROTSymbiosis​(java.lang.String rulestring)
      Creates a HROT Symbiosis rule with the specified rulestring
      Parameters:
      rulestring - The rulestring of the symbiosis rule
  • Method Details

    • fromRulestring

      protected void fromRulestring​(java.lang.String rulestring) throws java.lang.IllegalArgumentException
      Loads the rule's parameters from a rulestring
      Overrides:
      fromRulestring in class HROT
      Parameters:
      rulestring - The rulestring of the HROT Symbiosis rule (eg. B3/S23Symbiosis, R2,C2,S6-9,B7-8,NMSymbiosis)
      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.
      Overrides:
      canonise in class HROT
      Parameters:
      rulestring - The rulestring to canonised
      Returns:
      Canonised rulestring
    • getRegex

      public java.lang.String[] getRegex()
      The regexes that will match a valid rulestring
      Overrides:
      getRegex in class HROT
      Returns:
      An array of regexes that will match a valid rulestring
    • getDescription

      public java.lang.String getDescription()
      Returns a plain text description of the HROT Symbiosis rule family to be displayed in the Rule Dialog
      Overrides:
      getDescription in class HROT
      Returns:
      Description of the HROT Symbiosis rule family
    • generateApgtable

      public RuleDirective[] generateApgtable()
      Generates an apgtable for apgsearch to use
      Specified by:
      generateApgtable in interface ApgtableGeneratable
      Overrides:
      generateApgtable in class HROT
      Returns:
      True if the operation was successful, false otherwise
    • transitionFunc

      public int transitionFunc​(int[] neighbours, int cellState, int generations, Coordinate coordinate)
      Description copied from class: Rule
      This method represents the transition function of the rule
      Overrides:
      transitionFunc in class HROT
      Parameters:
      neighbours - The cell's neighbours in the order of the neighbourhood provided
      cellState - The current state of the cell
      generations - The current generation of the simulation
      coordinate - 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
      Overrides:
      clone in class HROT
      Returns:
      Returns a deep copy of the HROT rule