コード例 #1
0
        public SmallBoard Clone()
        {
            SmallBoard board = new SmallBoard();

            board.field = (Player[, ])field.Clone();

            return(board);
        }
コード例 #2
0
        public UTTT(PictureBox box)
        {
            field = box;

            if (field.Size.Height < field.Size.Width)
            {
                size = field.Size.Height;
            }
            else
            {
                size = field.Size.Width;
            }

            delta_position = (field.Size.Width - size) / 2;

            big_square_size   = size / 3;
            small_square_size = (int)(big_square_size / 3 * 0.8);
            delta_size        = (int)((big_square_size / 3 - small_square_size) * 1.5);

            image = new Bitmap(size, size);

            fieldGraphics = field.CreateGraphics();
            imageGraphics = Graphics.FromImage(image);

            fieldGraphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
            imageGraphics.InterpolationMode = InterpolationMode.HighQualityBilinear;

            fieldGraphics.SmoothingMode = SmoothingMode.HighQuality;
            imageGraphics.SmoothingMode = SmoothingMode.HighQuality;

            pen = new Pen(Color.Black, 2);

            x_color = Color.FromArgb(70, 215, 255);
            o_color = Color.FromArgb(255, 95, 92);

            area_color  = Color.FromArgb(255, 254, 120);
            x_win_color = Color.FromArgb(204, 245, 255);
            o_win_color = Color.FromArgb(255, 219, 213);

            board = new SmallBoard[3, 3];
            areas = new bool[3, 3];

            lastBig   = new Point(-1, -1);
            lastSmall = new Point(-1, -1);

            gameIsEnded = false;

            for (int row = 0; row < 3; ++row)
            {
                for (int column = 0; column < 3; ++column)
                {
                    board[row, column] = new SmallBoard();
                    areas[row, column] = true;
                }
            }
        }