def createLSystem(numIters, axiom):
    startString = axiom
    endString = ""
    for i in range(numIters):
        endString = processString(startString)
        startString = endString

    return endString


def processString(oldStr):
    newstr = ""
    for ch in oldStr:
        newstr = newstr + applyRules(ch)

    return newstr


def applyRules(ch):
    if ch == 'F':
        newstr = 'F-F++F-F'  # Rule 1
    else:
        newstr = ch  # no rules apply so keep the character

    return newstr


def drawLsystem(aTurtle, instructions, angle, distance):
    for cmd in instructions:
        if cmd == 'F':
            aTurtle.forward(distance)
        elif cmd == 'B':
            aTurtle.backward(distance)
        elif cmd == '+':
            aTurtle.right(angle)
        elif cmd == '-':
            aTurtle.left(angle)


class Screen:
    def exitonclick(self):
        pass


class Turtle:
    def speed(self, param):
        pass

    def down(self):
        pass

    def back(self, param):
        pass

    def up(self):
        pass

