public void moveTo(int x, int y) { if (board.isValidPosition(x, y)) { if (x == this.x + 1 || x == this.x - 1) { if (y == this.y + 1 || y == this.y - 1) { this.x = x; this.y = y; } } } }