Chaos game: Difference between revisions
Content added Content deleted
(Added Uiua solution) |
|||
Line 3,481: | Line 3,481: | ||
Dim ← 500 |
Dim ← 500 |
||
Points ← [[50 ⌊÷2Dim] [-50Dim 50] [-50Dim -50Dim]] |
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 ← ⌊×⚂ |
Rand ← ⌊×⚂ |
||
↯Dim_Dim_3 0 |
|||
∧(⍜(⊡|[1 1 1]◌))Points |
|||
⊟Rand Dim Rand Dim |
⊟Rand Dim Rand Dim |
||
⍥( |
⍥( |
||
Rand⧻Points |
Rand⧻Points |
||
# Set next point and colour based on target. |
# Set next point and colour based on target. |
||
⊃(⌊÷2+ |
⊃(⌊÷2+⊡:Points|⊙◌⊡:Colours) |
||
⟜⍜⊡◌⊙: |
|||
⟜⍜⊡(◌)⊙: |
|||
)10000 |
|||
)20000 |
|||
◌ |
◌ |
||
# Uncomment to save image. |
# Uncomment to save image. |
||
# &fwa "UiuaChaosGameSerpinski.png" &ime "png" |
# &fwa "UiuaChaosGameSerpinski.png" &ime "png" |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
{{out}} |