Hmm, I dimmed p to double and it seems to work ok. After reading your key input problem I decided to add some keyboard control. Here's a newer version with some added features.
Press +/- to zoom in and out of fractal. Press SPACE to jump to a new pattern number (p variable random change). Press ESC to quit. I changed drawing to using CIRCLE to make it look more solid while zoomed up.
- Dav
Press +/- to zoom in and out of fractal. Press SPACE to jump to a new pattern number (p variable random change). Press ESC to quit. I changed drawing to using CIRCLE to make it look more solid while zoomed up.
- Dav
Code: (Select All)
'dragoncurve.bas - v2
'A play on a dragon curve fractal
'Adapted by Dav, OCT/2023
'v2 - New keyboard control. Press +/- to zoom, SPACE resets, ESC ends.
Screen _NewImage(800, 600, 32)
Dim Shared p As Double: p = Rnd: size = 200
Do
Cls: dragon 400, 300, size, a, 15
Select Case Inp(&H60)
Case 13: If size < 1200 Then size = size + 5
Case 12: If size > 25 Then size = size - 5
Case 57: p = Rnd
Case 1: Exit Do
End Select
_Limit 15: _Display
a = a + .15: p = p + .001
Loop
Sub dragon (x, y, size, ang, depth)
If depth < 1 Then
'PSet (x, y), _RGBA(50, 150, 255, 50 + Rnd * 200)
Circle (x, y), size / 3, _RGBA(50, 150, 255, 50 + Rnd * 200)
Else
size2 = size / Sqr(2): ang2 = ang - _Pi / p
dragon x, y, size2, ang + _Pi / p, depth - 1
dragon x + size2 * Cos(ang), y + size2 * Sin(ang), size2, ang2, depth - 1
End If
End Sub