Yesterday, 03:45 PM
bplus riffing on the last again:
Code: (Select All)
rowStart = 11: rowEnd = 15 ' 5 vertical rows 5 * 16 = 80 pixels
colStart = 36: colEnd = 45 ' 10 columns 10 * 8 = 80 pixels
' 80 pixels X 8- pixels = true square in screen 0
' pick a color 0 to 7 not 0 say
sqH = 5 ' 1 to 25 rows
sqW = 2 * sqH ' for a square width = 2*height = twice as many columns
sqLeft = 36 ' left most column
sqTop = 11 ' top most row
backcolor = 4 ' try different colors here 4 is red
GoSub printSquare
Locate 22, 23: Print "zzz... press any for random squares"
Sleep
' riffing again
' pick a random square height max is 25
Do
sqH = Int(Rnd * 25) + 1 ' 1 to 25 rows
sqW = 2 * sqH ' for a square width = 2*height = twice as many columns
sqLeft = Int(Rnd * (80 - sqW)) + 1 ' left most column
sqTop = Int(Rnd * (25 - sqH)) + 1 ' top most row
backcolor = (backcolor + 1) Mod 8 ' 0 to 7 colors (including black as "eraser"
GoSub printSquare
_Limit 2
Loop Until _KeyDown(27) ' until escape key is pressewd
End
printSquare:
Color , backcolor
For row = sqTop To sqTop + sqH - 1
For col = sqLeft To sqLeft + sqW - 1
Locate row, col: Print " "; ' print a space at each location of the square
Next
Next
Return
b = b + ...