// Warthog figures // Adapted from 1990 article in "American Scientific" // Tested first time in 90' using my ZX Spectrum 48K // Pere Casellas // version 20180520 using sdlBasic // GNU GPL 3.0 setDisplay( 1000, 650, 16, 2 ) setcaption("Warthog") // Initial variables //for f =1 to 250 //printS(f) // Change the parameter f to obtain incredible figures f=100 fprintS( "Segments number is:") printS(f) k=15 // segment units x=450 // initial x y=125 // initial y pi = 3.14159265 // Figure made of f segments for n =1 to f // Define colors if n<=f/3 then ink(rgb(255,0,0)) end if if n>f/3 then ink(rgb(0,255,0)) end if if n>(2*f/3) then ink(rgb(0,0,255)) end if // Warthog function zz=(n^3)/f z=2*pi*(zz-int(zz)) // angle as fractional part of zz x1=k*cos(z) y1=k*sin(z) xx=x+x1 yy=y+y1 // Draw segment line(x,y,xx,yy) // Define initial point x=xx y=yy next wait(100) waitKey cls //next