Ejemplo n.º 1
0
        public void tskAdd(TTskSet tsk)
        {
            TTskRandom tskRandom = new TTskRandom(parentCharFreqList, tskList.Count, tsk.keysRight, tsk.keysLeft, tsk.isAlone, tsk.color, tsk.minLen, tsk.maxLen);
            int        ind       = charsCount;

            chars    += ind.ToString();
            freq[ind] = tsk.freq;
            tskList.Add(tskRandom);
        }
Ejemplo n.º 2
0
        public void incTskCount()
        {
            TTskRandom tsk  = tskSelector.tskList[tskSelector.count - 1];
            int        dTsk = Math.Min(2, tsk.charsCount - tsk.count);

            if (dTsk == 0)
            {
                dTsk = 2;
            }
            tskCount += dTsk;
        }
Ejemplo n.º 3
0
        public void pointSet(int x, int y)
        {
            tskSelector.only.Clear();
            tskSelector.skip.clear();
            for (int i = 1; i < tskSelector.count; i++)
            {
                tskSelector[i].skip.clear();
            }

            foreach (XY xy in pointDirList)
            {
                int x1 = x, y1 = y, len = 0, newTsk = 0, tskNo = 0;
                for (; ;)
                {
                    x1 += xy.x;
                    y1 += xy.y;
                    if (lab.chars[x1, y1].isPill())
                    {
                        TTsk ch = lab.chars[x1, y1];
                        newTsk = ch.tskNo;
                        if (newTsk == 0)
                        {
                            break;
                        }
                        if (len != 0)
                        {
                            if (tskNo != newTsk)
                            {
                                break;
                            }
                        }
                        else
                        {
                            tskNo = newTsk;
                        }
                        len++;
                    }
                    else
                    {
                        break;
                    }
                }
                if (tskNo > 0)
                {
                    TTskRandom task = tskSelector[tskNo];
                    if ((task.isAlone) || (len > task.maxLen))
                    {
                        tskSelector.skip[tskNo] = true;
                        tskSelector.only.Remove(tskNo);
                    }
                    else
                    {
                        if ((len < task.minLen) && (task.count > 4) && (!tskSelector.skip[tskNo]))
                        {
                            tskSelector.only.Add(tskNo);
                        }
                    }
                }
            }
#if DEBUG
            for (int i = 1; i < tskSelector.count; i++)
            {
                if (!tskSelector.skip[i] && tskSelector[i].isAlone)
                {
                    if (check(x - 1, y, i) || check(x - 1, y, i) || check(x - 1, y, i) || check(x - 1, y, i))
                    {
                        throw new Exception("pointSet");
                    }
                }
            }
#endif
        }