Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Creating Rule Generators
Clone this wiki locally
You can create a rule generator by creating a class called
RuleGenerator which inherits from
core.generator.AbstractRuleGenerator class. This class should implement two essential methods:
- public RuleGenerator(SLDescription sl, ElapsedCpuTimer time): This is the constructor of the rule generator.
- public String generateRules(SLDescription sl, ElapsedCpuTimer time): This function is responsible returning the interaction rules and termination rules.
All functions are provided with the same two objects:
- Sprite Level Description (SLDescription) object: is a description object that provides the user with functions to retrieve information about the current level and the associated sprites. It provides the user with function to test rules and termination conditions. Follow this link for more information about SLDescription.
- Elapsed Cpu Timer (ElapsedCpuTimer) object: is a timer object that provides the amount allowed for this function.
generateRules function should return a 2 arrays of string. The first is an array of the interaction rules in the generated game. The second is an array of the termination conditions in the generated game.
The next pages shows sample of rule generators: