Creating Rule Generators

Raluca D. Gaina edited this page Feb 12, 2018 · 2 revisions

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.

The 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:

Table of Contents:

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.