Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Escape (1994 J. C. Sprott)
#1
Code: (Select All)
Rem Program ESCAPE.BAS (c) 1994 by J. C. Sprott
Dim a(12) 'Array of coefficients
Randomize Timer 'Reseed random numbers
Screen 12 'Assume VGA graphics
n% = 0
While InKey$ = "" 'Loop until a key is pressed
    If n% = 0 Then Call setparams(x, y)
    Call advancexy(x, y, n%)
    Call testsoln(x, y, n%)
    If n% = 1000 Then Call display: n% = 0
Wend
End

Sub advancexy (x, y, n%) 'Advance (x, y) at step n%
    Shared a()
    xnew = a(1) + x * (a(2) + a(3) * x + a(4) * y) + y * (a(5) + a(6) * y)
    y = a(7) + x * (a(8) + a(9) * x + a(10) * y) + y * (a(11) + a(12) * y)
    x = xnew
    n% = n% + 1
End Sub

Sub display () 'Plot escape-time contours
    For i% = 0 To 639
        For j% = 0 To 479
            x = -5 + i% / 64
            y = 5 - j% / 48
            n% = 0
            While n% < 128 And x * x + y * y < 1000000
                Call advancexy(x, y, n%)
            Wend
            PSet (i%, j%), n% Mod 16
        Next j%
    Next i%
    _Display
End Sub

Sub setparams (x, y) 'Set a() and initialize (x,y)
    Shared a()
    x = 0: y = 0
    For i% = 1 To 12: a(i%) = (Int(25 * Rnd) - 12) / 10: Next i%
End Sub

Sub testsoln (x, y, n%) 'Test the solution
    If n% = 1000 Then n% = 0 'Solution is bounded
    If x * x + y * y > 1000000 Then 'Solution escaped
        If n% > 100 Then n% = 1000 Else n% = 0
    End If
End Sub
Reply
#2
Same kind of fix inserting lines 35, 36 as Sprotts Integreted Functions
Code: (Select All)
Sleep 5
_KeyClear

Allows you to look for awhile or press a key for next screen.

+1 to Steve. So far these Steve picks are great!

This one would definitely benefit from a plasma coloring system!
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ITERATED FUNCTION SYSTEMS (1993 by J. C. Sprott) SMcNeill 2 836 11-16-2023, 10:41 PM
Last Post: Jack
  STRANGE ATTRACTOR ICON SEARCH (1995 J. C. Sprott ) SMcNeill 2 895 11-16-2023, 09:55 PM
Last Post: SMcNeill

Forum Jump:


Users browsing this thread: