Пример #1
0
        /// <summary> <!-- {{{1 --> Convert values to candidates
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        public static Candidates ToCandidates(IEnumerable <SudokuValue> values)
        {
            var candidates = SudokuValueExtension.ValueList().Except(values);
            var ret        = new Candidates();

            ret.Add(candidates);
            return(ret);
        }
Пример #2
0
        /// <summary> <!-- {{{1 --> Load sudoku cell value from string
        /// </summary>
        /// <param name="pat"></param>
        /// <returns></returns>
        public bool LoadFromStr(string pat)
        {
            if ((SudokuCellIndex.MAX - SudokuCellIndex.MIN + 1) > pat.Length)
            {
                return(true);
            }
            var vals = SudokuCellIndexExtension.IndexList()
                       .Select(x => SudokuValueExtension.FromStr(
                                   pat.Substring((int)x, 1)));
            var items = this.board.Zip(vals, (c, v) => new { Cell = c, Val = v });

            foreach (var i in items)
            {
                i.Cell.CopyFrom(i.Val);
            }
            return(false);
        }