Barnsley fern: Difference between revisions
m
→{{header|R}}: Syntax highlighting.
(add F# version) |
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
||
Line 2,370:
{{trans|PARI/GP}}
[[File:BarnsleyFernR.png|right|thumb|Output BarnsleyFernR.png]]
<lang
## Where: fn - file name; n - number of dots; clr - color; ttl - plot title;
## psz - picture size.
Line 2,416:
==='Obvious' solution===
The matrix solution above is a clever approach, but the following solution is more readable if you're unfamiliar with linear algebra. This is very much a blind "just do what the task says" solution. It's so simple that it probably runs unadapted in S. I suspect that there is room for an interesting use of R's ifelse function somewhere, but I couldn't find a clean way.
<lang
{
currentX<-currentY<-newX<-newY<-0
|