hilbert_curve.sf 355 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/ruby
  2. # https://rosettacode.org/wiki/Hilbert_curve
  3. include('LSystem/LSystem.sf')
  4. var rules = Hash(
  5. a => '-bF+aFa+Fb-',
  6. b => '+aF-bFb-Fa+',
  7. )
  8. var lsys = LSystem(
  9. width: 600,
  10. height: 600,
  11. xoff: -50,
  12. yoff: -50,
  13. len: 8,
  14. angle: 90,
  15. color: 'dark green',
  16. )
  17. lsys.execute('a', 6, "hilbert_curve.png", rules)