public List <DB_AGIN_Baccarat_Check_RstItem> Search(int maxOrder = int.MaxValue)
        {
            List <DB_AGIN_Baccarat_Check_RstItem> items = new List <DB_AGIN_Baccarat_Check_RstItem>();

            #region For: List cells and Sort by order
            List <DB_AGIN_Baccarat_Cell> cells = new List <DB_AGIN_Baccarat_Cell>();
            Baccarat.DataAnalysis.Cells.ForEach(x => {
                cells.AddRange(x.Where(y => 0 != y.Order && maxOrder >= y.Order));
            });
            cells = cells.OrderBy(x => x.Order).ToList();
            #endregion
            for (int sub_l = 0; sub_l <= SubLMax && sub_l + FreqMin * (sub_l + 1) <= cells.Count; sub_l++)
            {
                IEnumerable <DB_AGIN_Baccarat_Cell> cells_main = cells.Take(cells.Count - sub_l);
                IEnumerable <DB_AGIN_Baccarat_Cell> cells_sub  = cells.Skip(cells.Count - sub_l).Take(sub_l);
                for (int freq_l = sub_l + 1; freq_l <= SubLMax + 1 && FreqMin * freq_l <= cells_main.Count(); freq_l++)
                {
                    bool stop = false; int freq_n = 0;
                    int  skip = cells_main.Count() - freq_l * (freq_n + 1);
                    IEnumerable <DB_AGIN_Baccarat_Cell> cells_freq = cells_main.Skip(0 > skip ? int.MaxValue : skip).Take(freq_l);

                    if (IsDupFreq(cells_freq))
                    {
                        continue;
                    }
                    for (int i = 0; i < cells_sub.Count(); i++)
                    {
                        if (i + 1 > cells_freq.Count() || cells_sub.ElementAt(i).CircleColor != cells_freq.ElementAt(i).CircleColor)
                        {
                            stop = true; break;
                        }
                    }
                    while (!stop && 0 != ++freq_n)
                    {
                        skip = cells_main.Count() - freq_l * (freq_n + 1);
                        IEnumerable <DB_AGIN_Baccarat_Cell> cells_freqn = cells_main.Skip(0 > skip ? int.MaxValue : skip).Take(freq_l);
                        for (int i = 0; i < cells_freq.Count(); i++)
                        {
                            if (i + 1 > cells_freqn.Count() || cells_freq.ElementAt(i).CircleColor != cells_freqn.ElementAt(i).CircleColor)
                            {
                                stop = true; break;
                            }
                        }
                    }

                    DB_AGIN_Baccarat_Check_RstItem item = new DB_AGIN_Baccarat_Check_RstItem(freq_n, cells_freq.ToList(), cells_sub.ToList());
                    if (IsValidRstItem(item))
                    {
                        items.Add(item);
                    }
                }
            }
            return(items);
        }
 private bool IsValidRstItem(DB_AGIN_Baccarat_Check_RstItem rstItem)
 {
     if (FreqMin > rstItem.NFreq)
     {
         return(false);
     }
     foreach (KeyValuePair <int, int> total_l_min in TotalLMin)
     {
         if (rstItem.CellsFreq.Count == total_l_min.Key)
         {
             return(total_l_min.Value <= rstItem.NFreq * rstItem.CellsFreq.Count + rstItem.CellsSub.Count);
         }
     }
     return(true);
 }