Value | Meaning |
---|---|
black | Main diagonal color |
red | First sub-diagonal color |
import mir.ndslice.allocation: slice; auto s = [5, 4].slice!int; Chequer.black.each!"a = 1"(s); assert(s == [ [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], ]); Chequer.red.each!((ref b) => b = 2)(s); assert(s == [ [1, 2, 1, 2], [2, 1, 2, 1], [1, 2, 1, 2], [2, 1, 2, 1], [1, 2, 1, 2], ]);
Chequer color selector to work with each