I am student trying to explore simple 'L-Systems' in a simple C program.. apparently not simple enough for me.
I would like to write a program which looks at a string and replaces parts of it conditionally, through a number of trials.
Output to the effect of:Code:starting with string = 'a' for NUMTRIALS i++ for STRINGLEN j++ if( string[j] == 'a' ) string[j] = 'b' else if ( string[j] == 'b' ) string[j] = 'ab'
i = 0 string = 'a'
i = 1 string = 'b'
i = 2 string = 'ab'
i = 3 string = 'bab'
i = 4 string = 'abbab'
* thought it better to write it so it could be understood despite my incompetence.
I have tried to do this with character strings and boggled my mind.
It would be fine to do it with integers and then convert to letters.
Any suggestions for how to represent this (types, procedure, existing lib functions!) would be appreciated.
Thank you for reading this, and any help.