Results 1 to 4 of 4
Thread: Fibonacci L-System
- 09-27-2011, 02:59 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Fibonacci L-System
Recently having problem on solving this java asgnmnt and I am lost on this question :
In a Java class called Rewrite write a recursive instance method called lindenmeyer that
takes in a String: start and an integer iters and applies the following set of rules:
A -> AB
B -> BC
C -> D
D -> A
and applies them to the String start simultaneously iter times in succession returning
the new String. By simultaneously we mean that produce a result that looks as if each
rule is applied to input string at the same time. So, for example the call:
lindenmeyer("A",1)
returns the string “AB” and the call:
lindenmeyer("A",2)
returns the string “ABBC” and, finally, the call:
lindenmeyer("A",3)
returns the string “ABBCBCD”.
Hint: parallel rewriting of a string like this is harder than it looks (especially if it is done
in situ) because we have to avoid rules we apply later picking up on changes made by
rules we applied earlier. A simple trick is to make the rules match uppercase letters but
produce lowercase letters. Once all the rewrites are applied you can then convert the
whole string back to upper case.
*any advise would be much appreciated...
- 09-27-2011, 03:06 PM #2
Re: Fibonacci L-System
What part are you confused about? What have you tried? Where are you stuck?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 09-27-2011, 04:40 PM #3
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Re: Fibonacci L-System
i don't know how to start from scratch...thanks
- 09-27-2011, 04:51 PM #4
Re: Fibonacci L-System
Break the problem up into smaller pieces. How would you solve this without a computer, with just a piece of paper and a pencil? Pretend you have a really dumb friend who has no idea how to do it. Write out instructions, in English, that he could follow to accomplish the task. When you have that done, you'll have an algorithm that should be pretty easily translated into code.
But always focus on one small piece at a time. For example, part of your program takes in a String. Write a program that does ONLY that. Test that out and have it working perfectly before you move onto the next, most smallest step. That will also make it easier to post an SSCCE here when you get stuck.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Need Help - StackOverflowError - Fibonacci
By ausglanville in forum New To JavaReplies: 3Last Post: 04-13-2011, 03:43 AM -
Fibonacci Help
By zit1343 in forum New To JavaReplies: 16Last Post: 01-24-2011, 01:09 AM -
Fibonacci sequece
By Bgreen7887 in forum New To JavaReplies: 10Last Post: 12-03-2010, 07:27 PM -
Fibonacci sequence
By ŖàΫ ỏƒ Ңόρę in forum New To JavaReplies: 6Last Post: 03-25-2010, 06:59 AM -
help with fibonacci
By likemine in forum New To JavaReplies: 8Last Post: 01-07-2010, 02:32 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks