コード例 #1
0
ファイル: Reversi.cs プロジェクト: jakbrtz/MCTS
        void Draw(string msg)
        {
            Bitmap bmp = new Bitmap(panel1.Width, panel1.Height);

            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.Clear(Color.Green);
                for (int x = 0; x < ReversiNode.size; x++)
                {
                    for (int y = 0; y < ReversiNode.size; y++)
                    {
                        Rectangle rect = new Rectangle(x * bmp.Width / ReversiNode.size, (ReversiNode.size - 1 - y) * bmp.Height / ReversiNode.size, bmp.Width / ReversiNode.size, bmp.Height / ReversiNode.size);
                        g.DrawRectangle(Pens.Black, rect);
                        if (gamenode.GetPiece(x, y) == 0)
                        {
                            g.FillEllipse(Brushes.White, rect);
                        }
                        if (gamenode.GetPiece(x, y) == 1)
                        {
                            g.FillEllipse(Brushes.Black, rect);
                        }
                    }
                }
            }
            Invoke((MethodInvoker) delegate
            {
                panel1.BackgroundImage = bmp;
                Response.Text          = msg;
            });
        }