I'm trying to design data structure for an implementation of L-System rewriting engine in C++ and I just can't seem to get anywhere :(.
I need to store a string of symbols (characters). There are be several types of symbols (that's specified by the LSystem's alphabet). Let's say we have types "A", "B", "C". Now each type of symbol can have different parameters. For example symbol of type A will have some distance and symbol B an angle. C symbol has no parameters. The string then could look like "ABABC".
Then I need to iterate through the string and do some actions that are also connected to each type of symbol. "A" could mean "draw line of 'distance' length" (distance is parameter of A), B "turn 'angle' degrees" and C finish painting.
I tried to have class Symbol and a child for each symbol type (class SymbolA, class SymbolB, class SymbolC), but I don't know how to create the string. I would like to avoid type casts and stuff like that.
Is there somebody who had a similar problem or has an idea that can help me, please?