let
to_1d width height x y =
assert
(0 <= x
&&
x < width
&&
0 <= y
&&
y < height);
x*height + y