Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save WilliamLivingood/bffeb2e7db634ce52ad0c5f5c66aa512 to your computer and use it in GitHub Desktop.

Select an option

Save WilliamLivingood/bffeb2e7db634ce52ad0c5f5c66aa512 to your computer and use it in GitHub Desktop.
Random Length, Angle, and Systems
LSystem desy3() {
float moveDist = random(10, 40);
float rotateAngle = random(20, 60);
float scaleFactor = 1.9f;
String axiom = "F";
// Create any production rules
HashMap<Character, String> rules = new HashMap<>();
String[] produc = new String[] { "FF-[-F+F]F+[+F-F]F", "F+F--F+F[+F-F]", "F+F--F+F[-F][+F]F" };
rules.put('F', produc[(int) random(produc.length)]);
// Create and return the Lsystem
return new LSystem(axiom, rules, moveDist, rotateAngle, scaleFactor);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment