Chaos game: Difference between revisions

m
(Added Uiua solution)
Line 3,481:
Dim ← 500
Points ← [[50 ⌊÷2Dim] [-50Dim 50] [-50Dim -50Dim]]
# Uncomment to try different square or pentagonal references.
# Points ← [[50 50] [-50Dim 50] [50 -50Dim][-50Dim -50Dim]]
# Points ← [[50 ⌊÷2Dim] [⌊×0.4Dim 50] [⌊×0.4Dim -50Dim] [-50Dim 120] [-50Dim -120Dim]]
Colours ← [[1 0 0] [0 1 0] [0 0 1] [1 1 0] [1 0 1] [0 1 1]]
Rand ← ⌊×⚂
 
⍜(⊡|+[1 1 1]) Points ↯Dim_Dim_3 0
∧(⍜(⊡|[1 1 1]◌))Points
⊟Rand Dim Rand Dim
⍥(
Rand⧻Points
# Set next point and colour based on target.
⊃(⌊÷2+ ⊡:Points|⊙◌⍜⊡1⊙◌⊡:↯3 0Colours)
⟜⍜⊡◌⊙:
⟜⍜⊡(◌)⊙:
)10000
)20000
# Uncomment to save image.
# &fwa "UiuaChaosGameSerpinski.png" &ime "png"
 
</syntaxhighlight>
{{out}}
62

edits