micro(A)v11
#12
Try a translation to QB64:
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 + ...
Reply


Messages In This Thread
micro(A)v11 - by aurel - 07-07-2023, 03:05 PM
RE: mAv11 - by mnrvovrfc - 07-07-2023, 06:52 PM
RE: mAv11 - by mnrvovrfc - 07-07-2023, 07:08 PM
RE: mAv11 - by aurel - 07-07-2023, 09:30 PM
RE: mAv11 - by aurel - 07-10-2023, 04:13 PM
RE: mAv11 - by aurel - 07-10-2023, 07:17 PM
RE: micro(A)v11 - by aurel - 07-12-2023, 05:03 PM
RE: micro(A)v11 - by aurel - 07-13-2023, 06:38 PM
RE: micro(A)v11 - by mnrvovrfc - 07-13-2023, 07:08 PM
RE: micro(A)v11 - by aurel - 07-15-2023, 04:27 PM
RE: micro(A)v11 - by aurel - 07-16-2023, 02:52 PM
RE: micro(A)v11 - by bplus - 07-16-2023, 03:56 PM
RE: micro(A)v11 - by aurel - 07-16-2023, 06:19 PM
RE: micro(A)v11 - by bplus - 07-16-2023, 06:39 PM
RE: micro(A)v11 - by mnrvovrfc - 07-16-2023, 07:34 PM
RE: micro(A)v11 - by aurel - 07-16-2023, 09:34 PM
RE: micro(A)v11 - by aurel - 07-16-2023, 09:42 PM
RE: micro(A)v11 - by aurel - 07-19-2023, 11:53 AM
RE: micro(A)v11 - by aurel - 07-21-2023, 06:38 AM
RE: micro(A)v11 - by mnrvovrfc - 07-21-2023, 06:45 AM
RE: micro(A)v11 - by aurel - 07-21-2023, 09:09 PM
RE: micro(A)v11 - by mnrvovrfc - 07-24-2023, 02:23 AM
RE: micro(A)v11 - by aurel - 07-24-2023, 07:00 AM
RE: micro(A)v11 - by aurel - 07-25-2023, 09:16 PM
RE: micro(A)v11 - by aurel - 07-26-2023, 05:30 PM
RE: micro(A)v11 - by aurel - 07-26-2023, 10:42 PM
RE: micro(A)v11 - by aurel - 07-27-2023, 09:55 AM
RE: micro(A)v11 - by mnrvovrfc - 07-28-2023, 02:29 AM
RE: micro(A)v11 - by mnrvovrfc - 07-28-2023, 07:42 AM
RE: micro(A)v11 - by aurel - 07-28-2023, 06:43 AM
RE: micro(A)v11 - by aurel - 07-28-2023, 09:38 AM
RE: micro(A)v11 - by mnrvovrfc - 07-28-2023, 05:59 PM
RE: micro(A)v11 - by aurel - 07-28-2023, 07:14 PM
RE: micro(A)v11 - by bplus - 07-29-2023, 03:09 PM
RE: micro(A)v11 - by mnrvovrfc - 07-29-2023, 07:07 PM
RE: micro(A)v11 - by bplus - 07-29-2023, 07:45 PM
RE: micro(A)v11 - by aurel - 07-29-2023, 09:30 PM
RE: micro(A)v11 - by aurel - 07-29-2023, 09:31 PM
RE: micro(A)v11 - by bplus - 07-29-2023, 09:53 PM
RE: micro(A)v11 - by mnrvovrfc - 07-29-2023, 10:10 PM
RE: micro(A)v11 - by aurel - 07-30-2023, 09:49 AM
RE: micro(A)v11 - by bplus - 07-30-2023, 02:35 PM
RE: micro(A)v11 - by aurel - 07-30-2023, 03:05 PM
RE: micro(A)v11 - by mnrvovrfc - 07-31-2023, 01:54 PM
RE: micro(A)v11 - by aurel - 07-31-2023, 02:10 PM
RE: micro(A)v11 - by mnrvovrfc - 07-31-2023, 02:39 PM
RE: micro(A)v11 - by aurel - 07-31-2023, 03:09 PM
RE: micro(A)v11 - by aurel - 07-31-2023, 03:10 PM
RE: micro(A)v11 - by mnrvovrfc - 08-01-2023, 03:12 PM
RE: micro(A)v11 - by bplus - 08-01-2023, 03:36 PM
RE: micro(A)v11 - by mnrvovrfc - 08-01-2023, 11:49 PM
RE: micro(A)v11 - by aurel - 08-02-2023, 08:21 AM
RE: micro(A)v11 - by mnrvovrfc - 08-08-2023, 03:59 AM
RE: micro(A)v11 - by aurel - 08-08-2023, 10:18 AM
RE: micro(A)v11 - by mnrvovrfc - 08-11-2023, 08:43 AM
RE: micro(A)v11 - by bplus - 08-11-2023, 09:17 AM
RE: micro(A)v11 - by aurel - 08-11-2023, 11:39 AM
RE: micro(A)v11 - by bplus - 08-11-2023, 01:19 PM
RE: micro(A)v11 - by aurel - 08-11-2023, 07:43 PM
RE: micro(A)v11 - by aurel - 08-11-2023, 10:41 PM
RE: micro(A)v11 - by aurel - 08-12-2023, 10:31 AM
RE: micro(A)v11 - by aurel - 08-12-2023, 10:36 AM
RE: micro(A)v11 - by aurel - 08-12-2023, 10:47 AM
RE: micro(A)v11 - by aurel - 08-12-2023, 10:49 AM
RE: micro(A)v11 - by mnrvovrfc - 08-12-2023, 12:18 PM
RE: micro(A)v11 - by bplus - 08-12-2023, 12:59 PM
RE: micro(A)v11 - by mnrvovrfc - 08-12-2023, 02:49 PM
RE: micro(A)v11 - by aurel - 08-12-2023, 07:14 PM
RE: micro(A)v11 - by bplus - 08-12-2023, 07:35 PM
RE: micro(A)v11 - by aurel - 08-12-2023, 09:02 PM
RE: micro(A)v11 - by mnrvovrfc - 08-14-2023, 04:43 PM
RE: micro(A)v11 - by aurel - 08-15-2023, 07:36 AM
RE: micro(A)v11 - by bplus - 08-15-2023, 12:42 PM
RE: micro(A)v11 - by aurel - 08-15-2023, 06:44 PM
RE: micro(A)v11 - by mnrvovrfc - 08-15-2023, 10:07 PM
RE: micro(A)v11 - by aurel - 08-16-2023, 06:51 AM
RE: micro(A)v11 - by aurel - 08-16-2023, 09:03 AM
RE: micro(A)v11 - by aurel - 08-20-2023, 10:54 AM
RE: micro(A)v11 - by mnrvovrfc - 08-20-2023, 01:23 PM
RE: micro(A)v11 - by aurel - 08-20-2023, 03:08 PM
RE: micro(A)v11 - by dbox - 08-20-2023, 03:46 PM
RE: micro(A)v11 - by mnrvovrfc - 08-20-2023, 04:19 PM
RE: micro(A)v11 - by aurel - 08-20-2023, 09:51 PM
RE: micro(A)v11 - by aurel - 08-25-2023, 01:47 PM
RE: micro(A)v11 - by aurel - 08-30-2023, 08:24 PM
RE: micro(A)v11 - by mnrvovrfc - 08-30-2023, 08:36 PM
RE: micro(A)v11 - by TerryRitchie - 08-30-2023, 09:18 PM
RE: micro(A)v11 - by aurel - 08-30-2023, 09:20 PM
RE: micro(A)v11 - by aurel - 08-31-2023, 07:40 PM
RE: micro(A)v11 - by aurel - 08-31-2023, 08:13 PM
RE: micro(A)v11 - by bplus - 08-31-2023, 09:14 PM



Users browsing this thread: 44 Guest(s)