Class BoardConditionsChecker


  • public class BoardConditionsChecker
    extends Object
    For the training/testing restrictions on boards, as introduced in GS 6.010. See email discusion with Paul on 2023-03-08, and captive.html#cond
    • Constructor Detail

      • BoardConditionsChecker

        public BoardConditionsChecker()
    • Method Detail

      • boardIsAcceptable

        public static boolean boardIsAcceptable​(Board board,
                                                RuleSet rules,
                                                boolean testing)
        Parameters:
        testing - How is the condition applied? In the training mode (testing==false), the board is acceptable if no game piece satisfies any condition (i.e. is accepted by any row). In the testing mode (testing==true), the board is acceptable if at least one piece does.
        board - The board to test
        rules - The conditions, formatted as a rule set. Each row of the rule set represents one condition.
      • positionIsAllowed

        public static boolean positionIsAllowed​(int pos,
                                                RuleSet rules,
                                                boolean testing)
        This is to make board generation more efficient in the presence of a position-only rule. (For GS 7.008)
        Parameters:
        rules - a very simple rules set, consisting of a single fixed-position-only rule
        Returns:
        In training (testing==false), returns true if the rule set does not accept this position. In testing (testing==true), returns true if the rule set accepts this position.