Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
|||
' Munching squares - smallbasic - 27/07/2018
|
||||
size=256
|
||||
GraphicsWindow.Width=size
|
||||
GraphicsWindow.Height=size
|
||||
For i=0 To size-1
|
||||
For j=0 To size-1
|
||||
BitXor() 'color=i Xor j
|
||||
GraphicsWindow.SetPixel(i,j,GraphicsWindow.GetColorFromRGB(0,color,color))
|
||||
EndFor
|
||||
EndFor
|
||||
|
||||
Sub BitXor '(i,j)->color
|
||||
n=i
|
||||
Int2Bit()
|
||||
ib=ret
|
||||
n=j
|
||||
Int2Bit()
|
||||
jb=ret
|
||||
color=0
|
||||
For k=1 to 8
|
||||
ki=Text.GetSubText(ib,k,1)
|
||||
kj=Text.GetSubText(jb,k,1)
|
||||
If ki="1" Or kj="1" Then
|
||||
kk="1"
|
||||
Else
|
||||
kk="0"
|
||||
EndIf
|
||||
If ki="1" And kj="1" Then
|
||||
kk="0"
|
||||
EndIf
|
||||
color=2*color+kk
|
||||
EndFor
|
||||
EndSub
|
||||
|
||||
Sub Int2Bit 'n->ret
|
||||
x=n
|
||||
ret=""
|
||||
For k=1 to 8
|
||||
t=Math.Floor(x/2)
|
||||
r=Math.Remainder(x,2)
|
||||
ret=Text.Append(r,ret)
|
||||
x=t
|
||||
EndFor
|
||||
EndSub
|
||||
Loading…
Add table
Add a link
Reference in a new issue