5 - Branching
'
FizzBuzz for all primes to 11 (Bizz for 2, Fizz for 3, Buzz for 5, Fuzz for 7, Wow for 11 (standard version only does 3 and 5, Fizz and Buzz)
'
Fuzzy a program that has been around I imagine (third attempt to post)
Code: (Select All)
_Title "Globe-5 branching" 'b+ 2021-11-29
DefDbl A-Z
Const ss = 730
Screen _NewImage(ss, ss, 32)
_ScreenMove 250, 10
_Font 8
Dim As Integer top, l, r, n, i
aFix = _Pi(3 / 2)
top = (5 ^ 5 - 1) / 4
Dim xp(1 To top), yp(1 To top)
For l = 0 To 4
r = l * 90
n = 5 ^ l
stepper = _Pi(2 / n)
ao = stepper / 2
'Circle (ss / 2, ss / 2), r
For a = 0 To _Pi(2) - .000001 Step stepper
i = i + 1
xp(i) = ss / 2 + r * Cos(a + ao + aFix)
yp(i) = ss / 2 + r * Sin(a + ao + aFix)
'Circle (xp(i), yp(i)), 2
's$ = _Trim$(Str$(i))
'_PrintString (xp(i) - Len(s$) * 4, yp(i) - 4), s$
'Sleep
Next
Next
For i = 1 To 156
Line (xp(i), yp(i))-(xp(5 * i - 3), yp(5 * i - 3))
Line (xp(i), yp(i))-(xp(5 * i - 2), yp(5 * i - 2))
Line (xp(i), yp(i))-(xp(5 * i - 1), yp(5 * i - 1))
Line (xp(i), yp(i))-(xp(5 * i), yp(5 * i))
Line (xp(i), yp(i))-(xp(5 * i + 1), yp(5 * i + 1))
Next
Sleep
'
FizzBuzz for all primes to 11 (Bizz for 2, Fizz for 3, Buzz for 5, Fuzz for 7, Wow for 11 (standard version only does 3 and 5, Fizz and Buzz)
Code: (Select All)
_Title "FizzBuzz"
check$ = "0203050711": say$ = "BizzFizzBuzzFuzzWow"
For i = 1 To 100
Flag = 1
For j = 0 To 4
If i Mod Val(Mid$(check$, j * 2 + 1, 2)) = 0 Then Print Mid$(say$, j * 4 + 1, 4);: Flag = 0
Next
If Flag Then Print i, Else Print ,
Next
'
Fuzzy a program that has been around I imagine (third attempt to post)
Code: (Select All)
_Title "Fuzzy" 'B+ trans 2019-01-04
' from Fuzzy.bas SmallBASIC 0.12.8 [B+=MGA] 2016-12-18
'Another animation, the life of Fuzzy.
'// Fuzzy Logic Fractal
'// See: Scientific American Magazine, February 1993, "A Partly True Story"
'// http://en.wikipedia.org/wiki/Fuzzy_logic
'// FB - 201108147
'// Adapted to Yabasic 2.769 by Galileo 12/2016
'// drawing area
xa = -1.2: xb = 1.2: ya = -1.2: yb = 1.2
maxIt = 64 '// max iterations allowed
'// image size
imgx = 512: imgy = 512
Screen _NewImage(imgx, imgy, 32)
offs = .8
Do
For ky = 1 To imgy
For kx = 1 To imgx
x = kx * (xb - xa) / (imgx - 1) + xa
y = ky * (yb - ya) / (imgy - 1) + ya
For i = 1 To maxIt
If Sqr(x * x + y * y) + offs > 1.1 Then Exit For
x0 = 1 - Abs(x - y)
y = 1 - Abs(y - (1 - x))
x = x0
Color _RGB32((i Mod 8) * 32, (i Mod 4) * 64, (i Mod 16) * 16)
PSet (kx, ky)
Next i
Next kx
Next ky
offs = offs - .01
_Display
_Limit 5
Loop Until offs < -.2
b = b + ...