07-16-2023, 03:56 PM
Try a translation to QB64:
Well it can't be this messy and uncolorful! I guess something was lost in translation ;-))
How about a screen shot, sir!
Code: (Select All)
Option _Explicit
'by "roquedrivel" 15/07/23
'this program creates a "doodle" type effect
' which goes beyond four-leaf clovers and stuff like that
''mode 1
Dim a1, a2, b1, b2, f1, f2, g1, g2, i1, i2, j1, j2, xx, yy
Dim z1, z2, d2r, xo, yo
Dim xa, ya, xs, ys, xl, yl, xshrink, yshrink
Dim As Long i, j, o, rr, gg, bb, xoff, yoff
Dim x(1000), y(1000)
'"ptr" keyword is useless LOL
'initialize
d2r = _Pi / 180.0
xoff = 600
yoff = 400
rr = rand(32) * 4 + 96
gg = rand(32) * 4 + 96
bb = rand(32) * 4 + 96
a2 = 0
b1 = 180
b2 = 315
f1 = rand(10) / 2 + 1
f2 = rand(10) / 2 + 1
g1 = rand(11) / 4 + 1.5
g2 = rand(11) / 4 + 1.5
f1 = f1 * 100
f2 = f2 * 100
g1 = g1 * 100
g2 = g2 * 100
i1 = rand(1000) / 1000
i2 = rand(1000) / 1000
a1 = rand(1000) / 1000
If i1 > a1 Then
j1 = i1
i1 = (rand(33) + 67) / 100
End If
If i2 > a1 Then
j2 = i2
i2 = (rand(33) + 100) / 100
End If
i1 = i1 + rand(3)
i2 = i2 + rand(3)
j1 = j1 + rand(3)
j2 = j2 + rand(3)
o = rand(4)
a1 = 0
'create the plot
Randomize Timer
Screen _NewImage(xoff, yoff, 32)
restart:
'there's no "for" loop, this really sucks! I hate "while" without "do... loop"!
i = 1
fori01:
'for i = 1 to 1000
If o = 1 Then
z1 = a1 * d2r: z2 = b1 * d2r
xx = f1 * Cos(z1) + g1 * Sin(z2)
z1 = a2 * d2r: z2 = b2 * d2r
yy = f2 * Sin(z1) + g2 * Sin(z2)
End If
If o = 2 Then
z1 = a1 * d2r: z2 = b1 * d2r
xx = f1 * Cos(z1) + g1 * Sin(z2)
z1 = a2 * d2r: z2 = b2 * d2r
yy = f2 * (Sin(z1) + Sin(z2))
End If
If o = 3 Then
z1 = a1 * d2r: z2 = b1 * d2r
xx = f1 * (Cos(z1) + Sin(z2))
z1 = a2 * d2r: z2 = b2 * d2r
yy = f2 * Sin(z1) * g2 * Sin(z2)
End If
If o = 4 Then
z1 = a1 * d2r: z2 = b1 * d2r
xx = f1 * (Cos(z1) + Sin(z2))
z1 = a2 * d2r: z2 = b2 * d2r
yy = f2 * (Sin(z1) + Sin(z2))
End If
x(i) = Int(xx)
y(i) = Int(yy)
a1 = a1 + i1
If a1 > 360 Then a1 = a1 - 360
a2 = a2 + i2
If a2 > 360 Then a2 = a2 - 360
b1 = a1 + j1
If b1 > 360 Then b1 = b1 - 360
b2 = b2 + j2
If b2 > 360 Then b2 = b2 - 360
i = i + 1
If i < 1000 Then GoTo fori01
'next
'figure out which is the smallest of X and Y
xa = x(1)
ya = y(1)
i = 2
fori02:
'for i = 2 to 1000
If x(i) < xa Then xa = x(i)
If y(i) < ya Then ya = y(i)
i = i + 1
If i < 1000 Then GoTo fori02
'next
'make all coordinates positive or zero
Color , &HFF000000
xa = xa * (-1)
ya = ya * (-1)
i = 1
fori04:
x(i) = x(i) + xa
y(i) = y(i) + ya
i = i + 1
If i < 1000 Then GoTo fori04
'figure out the total width and height of the plot
xs = x(1)
ys = y(1)
xl = x(1)
yl = y(1)
i = 2
fori05:
'for i = 2 to 1000
If x(i) < xs Then xs = x(i)
If y(i) < ys Then ys = y(i)
If x(i) > xl Then xl = x(i)
If y(i) > yl Then yl = y(i)
i = i + 1
If i < 1000 Then GoTo fori05
'next
'use that information to scale the drawing to our graphics screen
xa = xl - xs
ya = yl - ys
If xa > xoff Then j = 1
If ya > yoff Then j = 1
If j = 1 Then
i = 1
fori06:
x(i) = (x(i) / xa) * xoff
y(i) = (y(i) / ya) * yoff
i = i + 1
If i < 1000 Then GoTo fori06
End If
'actually draw the thing
xo = x(1)
yo = y(1)
i = 2
fori03:
'for i = 1 to 1000
'Color _RGB32(rr, gg, bb)
Line (xo, yo)-(x(i), y(i)), _RGB32(rr, gg, bb) 'swap
xo = x(i)
yo = y(i)
i = i + 1
If i < 1000 Then GoTo fori03
'next
Color _RGB32(128, 0, 216)
_PrintString (0, 0), "ZZZ..."
'swap
Sleep
Cls
If _KeyDown(27) Then End
GoTo restart
Function rand% (n)
rand% = Int(Rnd * (n + 1))
End Function
Well it can't be this messy and uncolorful! I guess something was lost in translation ;-))
How about a screen shot, sir!
b = b + ...