lindenmayer.py revision 9bf2641af243c6ecae993439d67f300a4be9108b
'''
Copyright (C) 2005 Aaron Spike, aaron@ekips.org
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
def stripme(s):
return s.strip()
help="number of iteration")
help="angle for turn commands")
help="step size")
help="initial state of system")
help="replacement rules")
self.rules = dict([map(stripme, i.split("=")) for i in self.options.rules.upper().split(";") if i.count("=")==1])
for c in string:
if c in 'ABCDEF':
elif c in 'GHIJKL':
elif c == '+':
elif c == '-':
elif c == '|':
elif c == '[':
elif c == ']':
level_string = ''
for c in rule:
try:
except KeyError:
level_string = level_string + c
else:
level_string = level_string + c
return level_string
s = {'stroke-linejoin': 'miter', 'stroke-width': '1.0px',
'stroke-opacity': '1.0', 'fill-opacity': '1.0',
'stroke': '#000000', 'stroke-linecap': 'butt',
'fill': 'none'}
e = LSystem()
e.affect()