Package edu.wisc.game.engine
Class RuleSet
- java.lang.Object
-
- edu.wisc.game.engine.RuleSet
-
public class RuleSet extends Object
A RuleSet describes the rules of a game.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRuleSet.AtomSyntax:(counter,shape,color,position,bucketFunctions)static classRuleSet.BucketListA BucketList represents the information about the destination buckets given in the "buckets" field of an atom.static classRuleSet.BucketSelectorThe list of variables that can be used in the bucket expressionstatic classRuleSet.PositionListRepresents the restrictions on the positions from which game pieces can be pickedclassRuleSet.ReportedSrcThis is used for pretty-printing in the GUI client.static classRuleSet.RowA row object represents the content of one line of the rule set description file, i.e.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HashSet<Piece.Color>listAllColors()Lists all colors used in this rule set.TreeMap<String,TreeSet<String>>listAllPropValues()Lists all properties, and all property values, used in this rule set.HashSet<Piece.Shape>listAllShapes()Lists all shapes used in this rule set.static voidmain(String[] argv)RuleSet.ReportedSrcreportSrc()StringtoSrc()Format as the source code of the rules setStringtoString()
-
-
-
Field Detail
-
rows
public Vector<RuleSet.Row> rows
All rows of this rule set
-
-
Constructor Detail
-
RuleSet
public RuleSet(String ruleText) throws RuleParseException
- Throws:
RuleParseException
-
RuleSet
public RuleSet(String[] rr) throws RuleParseException
Creates a RuleSet based on the content of a rule set file. The file may contain some (optional) custom order definition lines, followed by one or more rule lines.- Parameters:
rr- The lines from the rule set file- Throws:
RuleParseException
-
-
Method Detail
-
toSrc
public String toSrc()
Format as the source code of the rules set
-
reportSrc
public RuleSet.ReportedSrc reportSrc()
-
listAllShapes
public HashSet<Piece.Shape> listAllShapes()
Lists all shapes used in this rule set.
-
listAllColors
public HashSet<Piece.Color> listAllColors()
Lists all colors used in this rule set.
-
listAllPropValues
public TreeMap<String,TreeSet<String>> listAllPropValues()
Lists all properties, and all property values, used in this rule set. This is primarily used for correctness checking during the experiment plan validation.
-
main
public static void main(String[] argv) throws IOException, RuleParseException
- Throws:
IOExceptionRuleParseException
-
-