The problem is the following:
chequerboard(n, m, offset_h, offset_w)
, all arguments >=1, returns an n
by m
chequerboard where each (region) is of size offset_h by offset_w, the top left cell is always filled, and only the right hand and bottom edge may contain incomplete chequers.
Examples:
chequerboard(6, 8, 2, 2) returns
[['#', '#', ' ', ' ', '#', '#', ' ', ' '],
['#', '#', ' ', ' ', '#', '#', ' ', ' '],
[' ', ' ', '#', '#', ' ', ' ', '#', '#'],
[' ', ' ', '#', '#', ' ', ' ', '#', '#'],
['#', '#', ' ', ' ', '#', '#', ' ', ' '],
['#', '#', ' ', ' ', '#', '#', ' ', ' ']]
chequerboard(5, 7, 2, 3) returns
[['#', '#', '#', ' ', ' ', ' ', '#'],
['#', '#', '#', ' ', ' ', ' ', '#'],
[' ', ' ', ' ', '#', '#', '#', ' '],
[' ', ' ', ' ', '#', '#', '#', ' '],
['#', '#', '#', ' ', ' ', ' ', '#']]
How can I solve it without Numpy? i.e., using only vanilla python?