Hey folks. I'm wondering if anyone can help me to find axioms of these pictures somehow
![[Image: 0?ui=2&ik=96f9b9e177&attid=0.3&permmsgid..._k7rhizl01]](https://mail.google.com/mail/u/0?ui=2&ik=96f9b9e177&attid=0.3&permmsgid=msg-a:r-6877912547217385333&view=att&disp=safe&realattid=f_k7rhizl01)
![[Image: 0?ui=2&ik=96f9b9e177&attid=0.1&permmsgid..._k7rhizog2]](https://mail.google.com/mail/u/0?ui=2&ik=96f9b9e177&attid=0.1&permmsgid=msg-a:r-6877912547217385333&view=att&disp=safe&realattid=f_k7rhizog2)
How to find axiom of this picture
How to find axiom of this picture
|
Mar-14-2020, 10:54 AM
Define "axiom" in this context. Also, what have you tried, or looked up or anything? We aren't here to do the work for you.
Mar-15-2020, 12:02 PM
Hello, thank you for your reply.
sorry about that. I forgot to show what I've worked. So this is what I've worked : import turtle D = 90 L = 10 def iterate(axiom, num=0, initator='F'): """ Compute turtle rule string by iterating on an axiom """ def translate(current, axiom): """ Translate all the "F" with the axiom for current string """ result = '' consts = {'+', '-', '[', ']'} for c in current: if c in consts: result += c continue if c == 'F': result += axiom return result # Set initator result = initator for i in range(0, num): # For ever iteration, translate the rule string result = translate(result, axiom) return result def draw(axiom, d=D, l=L): """ Use turtle to draw the L-System """ stack = [] # For tracking turtle positions screen = turtle.Screen() screen.bgcolor('black') screen.setup(width=1000,height=1000,startx = 500,starty=0) alex = turtle.Turtle() alex.pencolor('yellow') alex.up() alex.left(90) alex.setposition(0,-250) alex.down() alex.hideturtle() alex.speed(1) for i in range(len(axiom)): c = axiom[i] if c == 'F': alex.forward(l) if c == '-': alex.left(d) if c == '+': alex.right(d) if c == '[': stack.append((alex.heading(), alex.pos())) if c == ']': heading, position = stack.pop() alex.penup() alex.goto(position) alex.setheading(heading) alex.pendown() if __name__ == '__main__': axiom = "FF-[-F+F+F]+[+F-F-F]" axiom = iterate(axiom, 5, "F") draw(axiom, 25, 13)So using the FF-[-F+F+F]+[+F-F-F] as the axiom and using: [python] for i in range(len(axiom)): c = axiom[i] if c == 'F': alex.forward(l) if c == '-': alex.left(d) if c == '+': alex.right(d) if c == '[': stack.append((alex.heading(), alex.pos())) if c == ']': heading, position = stack.pop() alex.penup() alex.goto(position) alex.setheading(heading) alex.pendown() [\pyhton] as the rule will produce this image https://mail.google.com/mail/u/0?ui=2&ik..._k7szjeoz1 So now my lecturer told me to find the axiom of those pictures by applying the same rule. Thanks you. Sorry for my bad english. |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
How to modify and get the same picture | vokoyo | 1 | 2,833 |
Jul-07-2019, 11:37 AM Last Post: dataman |
|
Why there is no any input of the picture? | Tony | 2 | 3,380 |
May-19-2018, 07:20 AM Last Post: Tony |
Users browsing this thread: 1 Guest(s)