sierpinski_arrowhead_curve.sf 390 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/ruby
  2. # https://rosettacode.org/wiki/Sierpinski_arrowhead_curve
  3. include('LSystem/LSystem.sf')
  4. var rules = Hash(
  5. x => 'yF+xF+y',
  6. y => 'xF-yF-x',
  7. )
  8. var lsys = LSystem(
  9. width: 550,
  10. height: 500,
  11. xoff: -20,
  12. yoff: -30,
  13. len: 4,
  14. turn: -90,
  15. angle: 60,
  16. color: 'dark green',
  17. )
  18. lsys.execute('xF', 7, "sierpiński_arrowhead_curve.png", rules)