private boolean addRandomTile(int[][] board) {
        int emptyCnt = 0;
        for (int i = 0; i < board.length; i++) {
            for (int j = 0; j < board[i].length; j++) {
                if (board[i][j] == 0) {
                    emptyCnt++;
                }
            }
        }
        if (emptyCnt == 0) {
            return false;
        }
        int pos = rnd.nextInt(emptyCnt);
        int curPos = 0;
        for (int i = 0; i < board.length; i++) {
            for (int j = 0; j < board[i].length; j++) {
                if (board[i][j] == 0) {
                    if (curPos == pos) {
                        if (rnd.nextDouble() < 0.9) {
                            board[i][j] = 2;
                        } else {
                            board[i][j] = 4;
                        }
                        return true;
                    }
                    curPos++;
                }
            }
        }
        throw new RuntimeException();
    }