コード例 #1
0
        public static void Main(string[] args)
        {
            string HumanMove;
            string ComputerMove;

            while (true)
            {
                HumanMove   = ImageManipulator.HumanTurn(true);
                Values.LOG += HumanMove + " ";

                ComputerMove = CCEManipulator.GetBestMove(1000, true);
                Values.LOG  += ComputerMove + " ";

                Console.WriteLine(HumanMove);
                Console.WriteLine(" " + ComputerMove);
                Console.WriteLine();

                Utils.WaitForPress();
            }

            //Console.WriteLine(Values.LOG);

            Console.WriteLine("Processo terminato");
            Console.Read();
        }
コード例 #2
0
        /// <summary>
        /// Simulates a complete houman turn
        /// </summary>
        /// <returns>Dirty human move.</returns>
        public static string HumanTurn(bool save_bmp3, bool cleaned = true)
        {
            // Prendi e ridimensiona le immagini
            Bitmap bmp1 = Utils.ResizeImages(new Bitmap(Values.BMP1_PATH), Values.RESIZE_WIDTH, Values.RESIZE_HEIGHT);
            Bitmap bmp2 = Utils.ResizeImages(new Bitmap(Values.BMP2_PATH), Values.RESIZE_WIDTH, Values.RESIZE_HEIGHT);

            // Crea la immagine "differenza" e ricavane la mossa
            Bitmap bmp3 = ImageManipulator.getDifferenceBitmap(bmp2, bmp1);

            string HumanMove = ImageManipulator.GetHumanMove(bmp3, bmp1, save_bmp3);

            // Chiudi le immagini
            bmp1.Dispose();
            bmp2.Dispose();
            bmp3.Dispose();

            return((cleaned) ? Utils.ToEssential(HumanMove) : HumanMove);
        }