02-18-2023, 01:24 AM
(This post was last modified: 02-18-2023, 04:43 AM by bplus.
Edit Reason: More interesting mod
)
Today I've got it figured out and added the option to divide the sides of a screen from 2 to 10 cells:
Note: It is possible to get an all white screen or all black screen except for white grid.
Code: (Select All)
_Title "Checkered Checkers Recursive, press any for another screen..." ' b+ 2023-02-17
Screen _NewImage(740, 740, 12)
Randomize Timer
_ScreenMove 300, 0
Dim Shared As Long Divisor, DivisorMinusOne
While _KeyDown(27) = 0
Divisor = Int(Rnd * 9) + 2
DivisorMinusOne = Divisor - 1
ReDim Shared arr(DivisorMinusOne, DivisorMinusOne) ' holds pattern
For j = 0 To DivisorMinusOne
For i = 0 To DivisorMinusOne
If Rnd < .5 Then arr(i, j) = 1
Next
Next
CheckRecur 0, 0, (_Width - 1) / Divisor
Sleep
Cls
Wend
Sub CheckRecur (FirstX, FirstY, Side)
If Side <= 4 Then Exit Sub ' done
For y = 0 To DivisorMinusOne
For x = 0 To DivisorMinusOne
Line (FirstX + x * Side, FirstY + y * Side)-Step(Side, Side), , B
If Side / Divisor <= 4 Then
If arr(x, y) Then
Line (FirstX + x * Side + 1, FirstY + y * Side + 1)-Step(Side - 3, Side - 3), 15, BF
Else
Line (FirstX + x * Side + 1, FirstY + y * Side + 1)-Step(Side - 3, Side - 3), 0, BF
End If
Else
If arr(x, y) Then
CheckRecur FirstX + x * Side, FirstY + y * Side, Side / Divisor
End If
End If
Next
Next
End Sub
Note: It is possible to get an all white screen or all black screen except for white grid.
b = b + ...