Brownian tree: Difference between revisions
m
→{{header|Uiua}}: layout
(→{{header|Uiua}}: updated description and comments) |
m (→{{header|Uiua}}: layout) |
||
(One intermediate revision by the same user not shown) | |||
Line 5,422:
=={{header|Uiua}}==
Uiua Pad will show well-shaped arrays as images directly. If running locally you can uncomment the final few lines to save it as a file instead. (Running local is ~10 times faster too.)
[[File:UiuaBrownianTree.png|thumb]] Sample with higher values than provided code.▼
The main move loop passes round a pair of points: here and previous position, so when we hit a set cell we can just back up one.
Line 5,449 ⟶ 5,448:
# &fwa "BrownianTree.png"
</syntaxhighlight>
Or if you like your code terse :-)
<syntaxhighlight lang="Uiua">
S ← 80
⍜⊡(+1)↯2⌊÷2S↯S_S0
Rp ← (⊟⍥(⌊×⚂S)2)
Sd ← ⊟.⍢(Rp◌)(=1⊡) Rp
Nx ← ⟨Sd◌|∘⟩:⟜(/××⊃(≥0)(<S)⊢)⊟∵(-1+⌊×⚂3).⊢
⍜now⍥(⍜⊡(+1)◌°⊟⍢Nx(=0⊡⊢)Sd)500
</syntaxhighlight>
{{out}}
=={{header|Visual Basic .NET}}==
|