Class StalemateTester


  • public class StalemateTester
    extends Object
    Tools for testing a rule set for a possibility of a stalemate. A stalemate is achieved when no piece cannot be removed from the board any more. This class may be useful for a rule set designer, to ensure that any rule sets offered to players will never stalemate. This tool was designed for GS4, and is not meant to work with the GS5 rule syntax.
    • Constructor Detail

      • StalemateTester

        public StalemateTester​(RuleSet rules0)
    • Method Detail

      • canStalemate

        public Board canStalemate​(Piece.Shape[] shapes,
                                  Piece.Color[] colors,
                                  String[] allImages)
        Is there any board composed of any pieces of the specified colors and shapes on which this rule set will stalemate? As always, we assume that all atoms in the rules are "non-disappearing", i.e. each bucket expression always produces a non-empty result.
      • canStalemate

        public boolean canStalemate​(edu.wisc.game.engine.StalemateTester.MBoard pieceGroups)
        Will this game stalemate if started with a specified board?
        Parameters:
        pieceGroups - The m-board whose content we'll try to remove. The method modififes the content of the board, removing all pieces it can. If the game does not stalemate, this board will be empty upon return from this method; if a stalemate is encountered, the board will contain pieces that can't be removed.