public Collection<XY> neighbors() { Collection<XY> neighbors = new ArrayList<XY>(4); for (int i : new int[] {-1, 0, 1}) { for (int j : new int[] {-1, 0, 1}) { if (i == 0 ^ j == 0) { XY neighbor = XY.at(x + i, y + j); if (neighbor != null) neighbors.add(neighbor); } } } return neighbors; }
public void set(int x, int y, ScribeMark mark) { set(XY.at(x, y), mark); }