Sierpinski pentagon: Difference between revisions

(→‎{{header|Wren}}: Added image)
(4 intermediate revisions by 3 users not shown)
Line 518:
=={{header|EasyLang}}==
{{Trans|Processing}}
[https://easylang.dev/show/#cod=pZHNrsIgEIX3PMVJ3GgbsSVpdNOHacroJemFBog/by+DqHXh3Vx2w/mYc2ZwXpNHj06sIMaJBi8mY+lidPxBI5UI4zBRAlrssFaoMbqAvUIFteE3s3cjZrJxODmLK24IRhM0zamBhBQAzLHUPRqu0/l1Z2K6lEfnMdhTdmoQIs3sER3U4VCQdK6o++z/QKts9ZZvLAdjv8g818IyJ6MpPIkcu0oNeOByp02I6B9SXYjFAv4Xnpv/Ef5T/rbhLdrlPFJI8UJVh7ZD18DlT2b0Dg== Run it]
[https://easylang.dev/ide/#run=order%20%3D%205%0A%23%20%0Abackground%20005%0Aclear%0Acolor%20999%0Alinewidth%200.2%0Ascale%20%3D%201%20%2F%20(2%20%2B%20cos%2072%20*%202)%0A%23%20%0Aproc%20pentagon%20x%20y%20side%20depth%20.%20.%0A%20%20%20if%20depth%20%3D%200%0A%20%20%20%20%20%20move%20x%20y%0A%20%20%20%20%20%20for%20angle%20%3D%200%20step%2072%20to%20288%0A%20%20%20%20%20%20%20%20%20x%20%2B%3D%20cos%20angle%20*%20side%0A%20%20%20%20%20%20%20%20%20y%20%2B%3D%20sin%20angle%20*%20side%0A%20%20%20%20%20%20%20%20%20line%20x%20y%0A%20%20%20%20%20%20.%0A%20%20%20else%0A%20%20%20%20%20%20side%20*%3D%20scale%0A%20%20%20%20%20%20dist%20%3D%20side%20%2B%20side%20*%20cos%2072%20*%202%0A%20%20%20%20%20%20for%20angle%20%3D%200%20step%2072%20to%20288%0A%20%20%20%20%20%20%20%20%20x%20%2B%3D%20cos%20angle%20*%20dist%0A%20%20%20%20%20%20%20%20%20y%20%2B%3D%20sin%20angle%20*%20dist%0A%20%20%20%20%20%20%20%20%20call%20pentagon%20x%20y%20side%20depth%20-%201%0A%20%20%20%20%20%20.%0A%20%20%20.%0A.%0Acall%20pentagon%2025%2015%2050%20order%20-%201%0A Run it]
<syntaxhighlight lang="easylang">
order = 5
#
background 005
clear
color 999
linewidth 0.2
scale = 1 / (2 + cos 72 * 2)
Line 542 ⟶ 540:
x += cos angle * dist
y += sin angle * dist
call pentagon x y side depth - 1
.
.
.
call pentagon 25 15 50 order - 1
</syntaxhighlight>
 
 
=={{header|FreeBASIC}}==
Line 1,706 ⟶ 1,703:
(formerly Perl 6)
{{works with|rakudo|2018-10}}
[[File:Perl6 pentaflake.svg|300x300px|thumb|right|5th order pentaflake]]
<syntaxhighlight lang="raku" line>constant $sides = 5;
constant order = 5;
Line 1,727 ⟶ 1,725:
$fh.say: '</svg>';
$fh.close;</syntaxhighlight>
 
See [http://rosettacode.org/mw/images/5/57/Perl6_pentaflake.svg 5th order pentaflake]
 
=={{header|Ruby}}==
Line 2,087 ⟶ 2,083:
{{libheader|DOME}}
Black backgound and slightly different palette to Go. Also pentagons are unfilled.
<syntaxhighlight lang="ecmascriptwren">import "graphics" for Canvas, Color
import "dome" for Window
import "math" for Math
Line 2,149 ⟶ 2,145:
 
var Game = SierpinskiPentagon.new(640, 640)</syntaxhighlight>
 
{{out}}
[[File:Wren-Sierpinski_pentagon.png|400px]]
 
=={{header|XPL0}}==
9,488

edits