peano_curve.sf 371 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/ruby
  2. # https://rosettacode.org/wiki/Peano_curve
  3. include('LSystem/LSystem.sf')
  4. var rules = Hash(
  5. l => 'lFrFl-F-rFlFr+F+lFrFl',
  6. r => 'rFlFr+F+lFrFl-F-rFlFr',
  7. )
  8. var lsys = LSystem(
  9. width: 500,
  10. height: 500,
  11. xoff: -50,
  12. yoff: -50,
  13. len: 5,
  14. angle: 90,
  15. color: 'dark green',
  16. )
  17. lsys.execute('l', 4, "peano_curve.png", rules)