include "io.mcl"

macro BOARD_SIZE 100 end

mem BOARD_SIZE 2 - + 1 @8

0 while dup BOARD_SIZE 2 - < do
   0 while dup BOARD_SIZE < do
      dup mem + !8 if
         dup mem + BOARD_SIZE + '*' @8
      else
         dup mem + BOARD_SIZE + ' ' @8 
      end
      1 +
   end
   
   mem + BOARD_SIZE + '\n' @8

   BOARD_SIZE 1 + mem BOARD_SIZE + puts

   // pattern
   mem     !8 1 shl
   mem 1 + !8
   bor

   1 while dup BOARD_SIZE 2 - < do
      swap 1 shl 7 band
      over mem + 1 + !8 bor
      2dup 110 swap shr 1 band
      swap mem + swap @8
      swap

      1 +
   end
   drop drop

   1 +
end
drop