Facebook
From UnixF, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 123
  1.     fun checkArea(x: Int, y: Int) {
  2.         var count = 0
  3.         if (battlePole[x][y] != mineIcon) {
  4.             for (i in x - 1..x + 1) {
  5.                 for (j in y - 1..y + 1) {
  6.                     try {
  7.                         if (battlePole[i][j] == mineIcon) count++
  8.                     } catch (e: IndexOutOfBoundsException) {
  9.                         //NOP
  10.                     }
  11.                 }
  12.             }
  13.             if (count > 0) battlePole[x][y] = "$count"
  14.             else battlePole[x][y] = clearIcon
  15.         }
  16.     }