(int p, String desc)
| 37 | } |
| 38 | |
| 39 | private void validate(int p, String desc) { |
| 40 | if (p < 1 || p > gridSize) |
| 41 | throw new IllegalArgumentException(desc + " index i out of bounds"); |
| 42 | } |
| 43 | |
| 44 | private boolean isInGrid(int row, int col) { |
| 45 | return row >= 1 && row <= gridSize && col >= 1 && col <= gridSize; |