Question
I need help with the following code. I have the correct production rules but can't figure out how to correctly determine the next generation if
I need help with the following code. I have the correct production rules but can't figure out how to correctly determine the next generation if the current generation isn't: A, B, +, or -. If the current generation is A my code will correctly display the next generation as: +B-A-B+. However, if I start of with +B-A-B+ as the current generation, the next generation is only computed as: +. I understand I need to implement a for loop for the getProd() method but I can't seem to figure this out and I have been going crazy because I can't figure it out.
Arrowhead Curve get Prod public class ArrowheadCurve Given the character, return the appropriate production for that character. Implements the Sierpinski Arrowhead Curve refer to https://en. Wikipedia.org/wiki/L-system Example 5 Sierpinski triangle (make sure to scroll down to the part about the Sierpinski Arrovhead Curve) eparam c the character to expand eretum the appropriate production for the given character. public static String get Prod char c) TODO: replace with your inplementation Scanner reader new Scanner System.in) reader next charAt (0) return "c"; end get Prod Given the String representing the current generation, return a new String that is the result of applying the get Prod rules to each character in the current generation. eparam curGen a String that is the current generation ereturn a new String that is the result of applying the get Prod rules to each character in the current generation. public static String nextGen (String curGen) TODO: replace with your inplementation return end nextGen
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started