I think i came up with something. I basicly just repeated the steps from previous task. the apply(left, right, state)
Update!!!
I found out how to remove the brackets but still haven't removed 2 outer ones. any ideer?
I did this:
def step(rules, state): result=[] for x in state: if x==rules: result.append(state) else: result.append(x) [inner for outer in result for inner in outer] print(result) #This funktion is not made yet. Dont think about it!!! def compute(depth, rules, start): print() step("F",["F","L","F","R","F","L","F"])Now i just need to flatten it but it didn't seem to work as planned.
Update!!!
I found out how to remove the brackets but still haven't removed 2 outer ones. any ideer?
I did this:
def step(rules, state): result=[] for x in state: if x==rules: result.append(state) else: result.append(x) flatten = [inner for outer in result for inner in outer] print(flatten) #This funktion is not made yet. Dont think about it!!! def compute(depth, rules, start): print() step("F",["F","L","F","R","F","L","F"])and got this
Output:['F', 'L', 'F', 'R', 'F', 'L', 'F', 'L', 'F', 'L', 'F', 'R', 'F', 'L', 'F', 'R', 'F', 'L', 'F', 'R', 'F', 'L', 'F', 'L', 'F', 'L', 'F', 'R', 'F', 'L', 'F']
But as you see i still need to remove the last 2 at each side.