(char[][] board)
| 3 | public class Question { |
| 4 | |
| 5 | public static int convertBoardToInt(char[][] board) { |
| 6 | int factor = 1; |
| 7 | int sum = 0; |
| 8 | for (int i = 0; i < board.length; i++) { |
| 9 | for (int j = 0; j < board[i].length; j++) { |
| 10 | int v = 0; |
| 11 | if (board[i][j] == 'x') { |
| 12 | v = 1; |
| 13 | } else if (board[i][j] == 'o') { |
| 14 | v = 2; |
| 15 | } |
| 16 | sum += v * factor; |
| 17 | factor *= 3; |
| 18 | } |
| 19 | } |
| 20 | return sum; |
| 21 | } |
| 22 | |
| 23 | public static void main(String[] args) { |
| 24 | char[][] board = { |