Jump to content



Photo
- - - - -

Mandelbrot fractal displayer

Classpad Fractals

  • Please log in to reply
No replies to this topic

#1 TheVanWithAMan

TheVanWithAMan

    Newbie

  • Members
  • Pip
  • 2 posts

  • Calculators:
    Classpad II Cp400

Posted 19 November 2023 - 05:50 AM

I'm trying to get ChatGPT to make code that displays the Mandelbrot fractal on the Classpad II cp400, but cant get it to work:

PROGRAM Fractal
ClrText
local xmax=2.0, xmin=-2.0, ymax=1.5, ymin=-1.5
local x, y, zx, zy, cx, cy, tmp
local max_iter = 100
local color
 
For x = 0 To 319 Step 1
  For y = 0 To 239 Step 1
    cx = xmin + (x / 320.0) * (xmax - xmin)
    cy = ymin + (y / 240.0) * (ymax - ymin)
    zx = 0.0
    zy = 0.0
    color = 0
 
    For iter = 0 To max_iter Step 1
      tmp = zx * zx - zy * zy + cx
      zy = 2.0 * zx * zy + cy
      zx = tmp
 
      If zx * zx + zy * zy > 4.0 Then
        Exit
      EndIf
    Next
 
    If color = max_iter Then
      color = 0
    EndIf
 
    SetPixel color, x, y
  Next
Next
DispGraph
EndPrgm
 






Also tagged with one or more of these keywords: Classpad, Fractals

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users