some useful printfs, pattern 1 (square) tested, works but not with the expected results
arguments pattern and size of painting matrix functions changed
pattern and size are always global