Beispiel #1
0
        int CountScore(Tuple <int[], int, int[], int, int> tup)
        {
            int score       = 0;
            var board       = tup.Item1;
            var route       = tup.Item3;
            var startRow    = tup.Item4;
            var startColumn = tup.Item5;

            PuzzDraPInvoke.MoveByRoute(board, route, startRow, startColumn);

            while (true)
            {
                int combo = PuzzDraPInvoke.EvalCombo(board);
                if (combo == 0)
                {
                    break;
                }
                score += combo * 1000;//リーチより価値を高くするための1000倍
                PuzzDraPInvoke.PushDownDrops(board);
                PuzzDraPInvoke.FillBoardRandom(board);
            }
            int reaches = PuzzDraPInvoke.CountReach(board);

            score += reaches;

            return(score);
        }
Beispiel #2
0
        void CalcDoubleLimitedSerachOnce(int beamWeight, int count)
        {
            string dirName = "results";

            if (!Directory.Exists(dirName))
            {
                Directory.CreateDirectory(dirName);
            }

            Console.WriteLine("解析開始 ビーム幅{0} 回数{1}", beamWeight, count);

            decimal otisum = 0;
            decimal nfsum  = 0;
            double  time   = 0;
            var     watch  = new Stopwatch();

            for (int j = 0; j < count; j++)
            {
                var board = GenerateRandomBoard();
                watch.Restart();
                var result = PuzzDraPInvoke.BeamSerach(board, beamWeight).Result;
                watch.Stop();
                time   += watch.Elapsed.TotalSeconds;
                otisum += CountScore(result);
                nfsum  += result.Item2;
                if ((j + 1) % 100 == 0)
                {
                    Console.WriteLine((j + 1) + ":" + (otisum / (j + 1)) + " / " + (nfsum / (j + 1)) + " / " + (time / (j + 1)));
                }
            }
            var text = string.Format("{0}/{1}/{2}/{3}", beamWeight, otisum / count, nfsum / count, time / count);

            File.WriteAllText(dirName + @"\result" + beamWeight + "w," + count + "c.txt", text);
            Console.WriteLine(text);
        }