Sierpinski curve: Difference between revisions

Add Factor
(C++/Java/Rust - added links to output images)
(Add Factor)
Line 68:
{{out}}
See: [https://slack-files.com/T0CNUL56D-F017EPDTKS4-6d6b01b464 sierpinski_curve.svg] (offsite SVG image)
 
=={{header|Factor}}==
{{works with|Factor|0.99 2020-08-14}}
<lang factor>USING: accessors kernel L-system sequences ui ;
 
: curve ( L-system -- L-system )
L-parser-dialect
{ "G" [ dup length>> draw-forward ] } suffix >>commands
[ 45 >>angle ] >>turtle-values
"F--XF--F--XF" >>axiom
{
{ "X" "XF+G+XF--F--XF+G+X" }
} >>rules ;
 
[ <L-system> curve "Sierpinski curve" open-window ] with-ui</lang>
 
 
When using the L-system visualizer, the following controls apply:
{| class="wikitable"
|+ Camera controls
|-
! Button !! Command
|-
| a || zoom in
|-
| z || zoom out
|-
| left arrow || turn left
|-
| right arrow || turn right
|-
| up arrow || pitch down
|-
| down arrow || pitch up
|-
| q || roll left
|-
| w || roll right
|}
{| class="wikitable"
|+ Other controls
|-
! Button !! Command
|-
| x || iterate L-system
|}
 
=={{header|Go}}==
1,827

edits