if you were describing a real world scenario then....areas of particular pattern/size tiles are already known, as there's design involved. that precludes having to write a computed solution. although go ahead if you find this interesting.
the hardest line to type correctly is: stty erase ^H