@@ -0,0 +1,1710 @@
+import java.util.Scanner;%0A%0A/**%0A * 10189 - Minesweeper%0A * @author kellend%0A *%0A */%0Apublic class Minesweeper %7B%0A  static Scanner in = new Scanner(System.in);%0A%0A  static int rows, cols;%0A%0A  public static void main(String%5B%5D args) %7B%0A    rows = in.nextInt();%0A    cols = in.nextInt();%0A    int i = 1;%0A    while (rows != 0 %7C%7C cols != 0) %7B%0A      in.nextLine();%0A      processCase(i);%0A      rows = in.nextInt();%0A      cols = in.nextInt();%0A      if (rows != 0 %7C%7C cols != 0) %7B%0A        System.out.println();%0A      %7D%0A      i++;%0A    %7D%0A%0A  %7D%0A%0A  static int%5B%5D%5B%5D mines;%0A  final static int MINE = 9999;%0A%0A  private static void processCase(int caseNum) %7B%0A    System.out.println(%22Field #%22 + caseNum + %22:%22);%0A    mines = new int%5Brows%5D%5Bcols%5D;%0A    for (int i = 0; i %3C rows; i++) %7B%0A      char%5B%5D line = in.nextLine().toCharArray();%0A      for (int j = 0; j %3C cols; j++) %7B%0A        if (line%5Bj%5D == '*') %7B%0A          mines%5Bi%5D%5Bj%5D = MINE;%0A        %7D%0A      %7D%0A    %7D%0A%0A    for (int i = 0; i %3C rows; i++) %7B%0A      for (int j = 0; j %3C cols; j++) %7B%0A        if (mines%5Bi%5D%5Bj%5D != MINE) %7B%0A          System.out.print(calc(i, j));%0A        %7D else %7B%0A          System.out.print('*');%0A        %7D%0A      %7D%0A      System.out.println();%0A    %7D%0A  %7D%0A%0A  private static int calc(int i, int j) %7B%0A    int total = 0;%0A    total += addMaybe(i - 1, j - 1);%0A    total += addMaybe(i - 1, j);%0A    total += addMaybe(i - 1, j + 1);%0A%0A    total += addMaybe(i, j - 1);%0A    total += addMaybe(i, j + 1);%0A%0A    total += addMaybe(i + 1, j - 1);%0A    total += addMaybe(i + 1, j);%0A    total += addMaybe(i + 1, j + 1);%0A    return total;%0A  %7D%0A%0A  private static int addMaybe(int i, int j) %7B%0A    if (i %3C 0 %7C%7C i %3E= rows %7C%7C j %3C 0 %7C%7C j %3E= cols) %7B%0A      return 0;%0A    %7D%0A    return mines%5Bi%5D%5Bj%5D == MINE ? 1 : 0;%0A  %7D%0A%0A%7D%0A

Add minesweeper