예제 #1
0
        private bool Apply(Cell[] cells, int number, Group group, IsolatedSingleResult result)
        {
            Cell isolated = null;

            foreach (Cell cell in cells)
            {
                if (cell.info is Number && ((Number)cell.info).Value == number)
                {
                    return(false);
                }
                if (cell.info is Notes && ((Notes)cell.info).Values[number])
                {
                    if (isolated == null)
                    {
                        isolated = cell;
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            if (isolated == null)
            {
                return(false);
            }
            isolated.info = new Number(number);
            result.AddEntry(isolated.Index, number, group, cells.Select(cell => cell.Index).ToArray());
            return(true);
        }
예제 #2
0
        private bool Apply(Cell[] cells, Group group, IsolatedSingleResult result)
        {
            bool flag = false;

            for (int k = 0; k < CellInfo.numbers; k++)
            {
                if (Apply(cells, k, group, result))
                {
                    flag = true;
                }
            }
            return(flag);
        }
예제 #3
0
        public override StrategyResult Apply(Board board, ref string outInfo)
        {
            IsolatedSingleResult result = new IsolatedSingleResult();
            bool flag = false;

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