Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recursion: 4 ways to get it working
#14
Here is a Checkerboard fresh from my brain and QB64 IDE:
Code: (Select All)
_Title "Checkerboard by recursion" ' b+ 2023-02-17
' 8 X 80 = 640
Screen _NewImage(640, 640, 12) ' use 16 QB colors
Check 1, 1
Sleep
Sub Check (x, y)
    If (y Mod 2) Then
        If x Mod 2 Then c = 4 Else c = 0
    Else
        If x Mod 2 Then c = 0 Else c = 4
    End If
    Line ((x - 1) * 80, (y - 1) * 80)-Step(80, 80), c, BF
    Line ((x - 1) * 80, (y - 1) * 80)-Step(79, 79), 14, B
    x = x + 1
    If x > 8 Then y = y + 1: x = 1
    If y > 8 Then
        Exit Sub
    Else
        Check x, y
    End If
End Sub
b = b + ...
Reply


Messages In This Thread
RE: Recursion: 4 ways to get it working - by bplus - 02-17-2023, 06:35 PM



Users browsing this thread: 1 Guest(s)