Exemple #1
0
        public override StrategyResult Apply(Board board, ref string outInfo)
        {
            TrapResult result = Apply(board, box => board.GetBox(box), cell => cell.Row, Group.Box, Group.Row);

            if (result != null)
            {
                return(result);
            }
            result = Apply(board, box => board.GetBox(box), cell => cell.Column, Group.Box, Group.Column);
            if (result != null)
            {
                return(result);
            }
            result = Apply(board, box => board.GetRow(box), cell => cell.Box, Group.Row, Group.Box);
            if (result != null)
            {
                return(result);
            }
            result = Apply(board, box => board.GetColumn(box), cell => cell.Box, Group.Column, Group.Box);
            if (result != null)
            {
                return(result);
            }
            return(null);
        }
Exemple #2
0
 private TrapResult Apply(Board board, Func <int, Cell[]> getGroup, Func <Cell, int> trapID,
                          Group groupType, Group trapType)
 {
     for (int k = 0; k < Board.size; k++)
     {
         Cell[] group = getGroup(k);
         for (int num = 0; num < CellInfo.numbers; num++)
         {
             TrapResult result = Apply(board, group, num, trapID, groupType, trapType);
             if (result != null)
             {
                 return(result);
             }
         }
     }
     return(null);
 }