implemented reading/writing of tile patterns