Beispiel #1
0
        public void DoStuff2(int typein, int din, int nin, int[] primes2in, int lin, long dtin)
        {
            primes = primes2in;
            type   = typein;
            d      = din;
            n      = nin;
            l      = lin;
            st     = DateTimeOffset.Now.ToUnixTimeMilliseconds();
            dt2    = dtin;
            plz    = new PosslistStuff();
            plz.SetDirecPath(direcpath);
            plz.LoadPossList(type, d, n);
            mss = new MovesetStuff();
            mss.SetDirecPath(direcpath);
            mss.LoadMovesetStuff(type, d, n);
            song   = new MoveItSingle();
            nofmax = 0;

            song.StartIt(primes, mss.GetMoveSet(), mss.GetNF(), plz.GetPossList(), plz.GetNR(), plz.GetNC(), mss.GetNMovez(), type);
            song.StartIt2(l);

            proc = new PossProcessor();

            proc.StartIt(plz.GetPossList(), plz.GetNR(), plz.GetNC(), primes);
            nt     = 0;
            dt     = 0;
            checko = plz.GetChecko();
            song.StartIt3(checko);
            nfalse = 0;
            while (dt < dt2)
            {
                nt++;

                song.DoSingleRun2();
                tf = song.GetTF();
                if (tf)
                {
                    nfalse++;
                }
                et = DateTimeOffset.Now.ToUnixTimeMilliseconds();
                dt = et - st;
            }
            Console.WriteLine("NFALSE: " + nfalse + " " + nt);
        }
Beispiel #2
0
        public void DoStuff(int typein, int din, int nin, int[] primes2in, int lin, long dtin, bool usedistin)
        {
            /*
             * Bins2:
             * [2^0 - 2^1)
             * [2^1 - 2^2)
             * ....
             *
             * Bins10:
             * [1 - 10)
             * [10 - 100)
             * [100 - 1000)
             *....
             */
            usedist = usedistin;
            if (usedist)
            {
                binos = new ArrayList();

                /*
                 * Binos stores the Recls, Countos stores the number of each
                 */
                countos = new ArrayList();
            }
            binz2     = new BigInteger[450];
            binz10    = new BigInteger[100];
            bins2     = new int[450];
            bins10    = new int[100];
            binz2[0]  = 2;
            binz10[0] = 10;
            for (int ajk = 0; ajk < 450; ajk++)
            {
                if (ajk < 100)
                {
                    if (ajk != 0)
                    {
                        binz10[ajk] = binz10[ajk - 1] * 10;
                    }
                    bins10[ajk] = 0;
                }
                if (ajk != 0)
                {
                    binz2[ajk] = binz2[ajk] * 2;
                }
                bins2[ajk] = 0;
            }
            primes = primes2in;
            type   = typein;
            d      = din;
            n      = nin;
            l      = lin;
            st     = DateTimeOffset.Now.ToUnixTimeMilliseconds();
            dt2    = dtin;
            plz    = new PosslistStuff();
            plz.SetDirecPath(direcpath);
            plz.LoadPossList(type, d, n);
            mss = new MovesetStuff();
            mss.SetDirecPath(direcpath);
            mss.LoadMovesetStuff(type, d, n);
            song   = new MoveItSingle();
            nofmax = 0;
            song.StartIt(primes, mss.GetMoveSet(), mss.GetNF(), plz.GetPossList(), plz.GetNR(), plz.GetNC(), mss.GetNMovez(), type);
            song.StartIt2(l);
            proc = new PossProcessor();
            proc.StartIt(plz.GetPossList(), plz.GetNR(), plz.GetNC(), primes);

            max  = 1;
            nt   = 0;
            dt   = 0;
            maxp = 1;
            while (dt < dt2)
            {
                nt++;


                song.DoSingleRun();

                if (false)
                {
                    Console.WriteLine("DEBUG 0 : " + dt);
                }
                tfvs = song.GetTFVS();
                if (false)
                {
                    Console.Write("\t");
                    l0 = tfvs.Length;
                    for (int jii = 0; jii < l0; jii++)
                    {
                        Console.Write(tfvs[jii] + " ");
                    }
                    Console.WriteLine();
                }


                proc.LoadTFVS(tfvs);
                biggy = proc.GetBiggy();
                if (usedist)
                {
                    b0 = binos.Contains(biggy);
                    if (b0)
                    {
                        i0 = binos.IndexOf(biggy);
                        c0 = (int)countos[i0];
                        c0++;
                        countos[i0] = c0;
                    }
                    else
                    {
                        binos.Add(biggy);
                        countos.Add(1);
                    }
                }
                if (maxp < proc.GetMaxPrime())
                {
                    maxp = proc.GetMaxPrime();
                }
                for (int ajk = 0; ajk < 450; ajk++)
                {
                    if (biggy < binz2[ajk])
                    {
                        b2  = ajk;
                        ajk = 450;
                    }
                }
                for (int ajk = 0; ajk < 100; ajk++)
                {
                    if (biggy < binz10[ajk])
                    {
                        b10 = ajk;
                        ajk = 100;
                    }
                }
                bins2[b2]++;
                bins10[b10]++;

                if (false)
                {
                    Console.WriteLine("DEBUG 1 : " + dt);
                }
                if (biggy == max)
                {
                    nofmax++;
                }
                if (biggy > max)
                {
                    nofmax = 1;
                    max    = biggy;
                }
                if (false)
                {
                    Console.WriteLine(biggy);
                }
                et = DateTimeOffset.Now.ToUnixTimeMilliseconds();
                dt = et - st;
            }
            if (true)
            {
                Console.WriteLine("MAX: " + max + " Number of Max: " + nofmax);
            }
            if (usedist)
            {
                binos2 = new ArrayList();
                nb     = binos.Count;
                for (int ajk = 0; ajk < nb; ajk++)
                {
                    binos2.Add(binos[ajk]);
                }
                binos2.Sort();
                countos2 = new ArrayList();
                for (int ajk = 0; ajk < nb; ajk++)
                {
                    i1 = binos.IndexOf(binos2[ajk]);
                    countos2.Add(countos[i1]);
                }
            }

            for (int ajk = 449; ajk > -1; ajk--)
            {
                if (bins2[ajk] != 0)
                {
                    nb2 = ajk + 1;
                    ajk = -1;
                }
            }
            for (int ajk = 99; ajk > -1; ajk--)
            {
                if (bins10[ajk] != 0)
                {
                    nb10 = ajk + 1;
                    ajk  = -1;
                }
            }
            bbins2  = new int[nb2];
            bbins10 = new int[nb10];
            for (int ajk = 0; ajk < nb2; ajk++)
            {
                bbins2[ajk] = bins2[ajk];
            }
            for (int ajk = 0; ajk < nb10; ajk++)
            {
                bbins10[ajk] = bins10[ajk];
            }
        }