Example #1
0
        private bool Apply(Cell[] cells, EliminationResult result)
        {
            List <int> numbers = new List <int>();

            foreach (Cell cell in cells)
            {
                if (cell.info is Number)
                {
                    numbers.Add(((Number)cell.info).Value);
                }
            }
            bool flag = false;

            foreach (Cell cell in cells)
            {
                if (cell.info is Notes)
                {
                    foreach (int number in numbers)
                    {
                        Notes notes = (Notes)cell.info;
                        if (notes.Values[number])
                        {
                            notes.Values[number] = false;
                            result.removedNotes[number].Add(cell.Index);
                            flag = true;
                        }
                    }
                }
            }
            return(flag);
        }
Example #2
0
        public override StrategyResult Apply(Board board, ref string outInfo)
        {
            EliminationResult result = new EliminationResult();
            bool flag = false;

            for (int k = 0; k < Board.size; k++)
            {
                if (Apply(board.GetBox(k), result))
                {
                    flag = true;
                }
                if (Apply(board.GetRow(k), result))
                {
                    flag = true;
                }
                if (Apply(board.GetColumn(k), result))
                {
                    flag = true;
                }
            }
            return(flag ? result : null);
        }