public int At(int x, int y) {
// The value must be zero or one.
int value = matrix.Get(x, y);
if (!(value == 0 || value == 1)) {
// this is really like an assert... not sure what better exception to use?
throw new ArgumentException("Bad value");
}
return value;
}