private int findIndex2(String rule) { rule = rule.trim(); if (rule.startsWith("m")) { int n = Integer.parseInt(rule.substring(1)); return -1 * Math.abs(n); } return Integer.parseInt(rule); }
protected int distanceTo(int[] p1, int[] p2) { return Math.abs(p1[0] - p2[0]) + Math.abs(p1[1] - p2[1]); }