Render a graphical pattern where each pixel is colored by the value of 'x xor y' from an arbitrary color table.

' 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 