Exemple #1
0
        static void RunCodePair(CodePair cp, int loops)
        {
            string pair_log = Path.Combine(DataDir, $"battles_{cp.A.name}_{cp.B.name}.log");

            using (StreamWriter log = new StreamWriter(pair_log))
            {
                for (int i = 0; i < loops; i++)
                {
                    string seedtxt = "";
                    int    seed;

                    foreach (var p in permutation2)
                    {
                        var res = Battle(i, cp.GetCode(p[0]).file, cp.GetCode(p[1]).file, log, seedtxt, out seed);
                        cp.AddPoints(p[0], res[0]);
                        cp.AddPoints(p[1], res[1]);

                        seedtxt = seed.ToString();
                        Console.WriteLine($"loop: {i}  a: {cp.A_p} b: {cp.B_p} {Path.GetFileNameWithoutExtension(cp.A.file)} {Path.GetFileNameWithoutExtension(cp.B.file)}");
                    }
                }

                string ll = $"Final: {cp.A_p} {cp.B_p} {cp.A.name} {cp.B.name}";
                log.WriteLine(ll);
                using (StreamWriter big_log = new StreamWriter(Path.Combine(DataDir, BigRecordFileName), true))
                {
                    big_log.WriteLine(ll);
                }
            }
        }
Exemple #2
0
        static List <CodePair> Tumbles(List <Code> code)
        {
            List <CodePair> cps = new List <CodePair>();

            for (int a = 0; a < code.Count; a++)
            {
                for (int b = a + 1; b < code.Count; b++)
                {
                    CodePair cp = new CodePair();
                    cp.A = code[a];
                    cp.B = code[b];
                    cps.Add(cp);
                }
            }
            return(cps);
        }