static SudokuBoard ReadBoard(int[] rawBoard) { int n = rawBoard.Length; if(n != SudokuBoard.ROW * SudokuBoard.COLUM) throw new ArgumentException("raw board is not valid"); var rows = new List<int>(); var cols = new List<int>(); var vals = new List<int>(); for (int i = 0; i < n; i++) { if (rawBoard[i] != 0) { rows.Add(i / 9); cols.Add(i % 9); vals.Add(rawBoard[i]); } } var ret = new SudokuBoard(); ret.Init(rows.ToArray(), cols.ToArray(), vals.ToArray()); return ret; }