Beispiel #1
0
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            int pos;
            ulong temp;
            BufferedPanel bp = (BufferedPanel)sender;

            // 盤面の石などの描画
            nowPlayer = playerArray[nowColor];
            // 盤面情報から描画
            temp = boardclass.GetBlack();
            while (temp > 0)
            {
                pos = cppWrapper.ConvertMoveBit(temp);
                e.Graphics.DrawImage(bkImg,
                    (pos / BOARD_SIZE) * m_mass_size + m_fix_x,
                    (pos % BOARD_SIZE) * m_mass_size + m_fix_y,
                    stone_size_x, stone_size_y);
                temp ^= (1UL << (int)pos);
            }

            temp = boardclass.GetWhite();
            while (temp > 0)
            {
                pos = cppWrapper.ConvertMoveBit(temp);
                e.Graphics.DrawImage(whImg,
                    (pos / BOARD_SIZE) * m_mass_size + m_fix_x,
                    (pos % BOARD_SIZE) * m_mass_size + m_fix_y,
                    stone_size_x, stone_size_y);
                temp ^= (1UL << (int)pos);
            }

            // 最後に打った手を強調する
            pos = boardclass.GetRecentMove();
            if (pos >= 0)
            {
                e.Graphics.DrawString("●", m_ft2, Brushes.OrangeRed,
                (pos / BOARD_SIZE) * m_mass_size + last_move_fix_x,
                (pos % BOARD_SIZE) * m_mass_size + last_move_fix_y);
            }

            // ゲーム中の場合かつプレイヤーの手番の場合、着手可能場所を表示
            if (m_mode == ON_GAME && m_cpuFlagProperty == false)
            {
                temp = cppWrapper.GetEnumMove(boardclass);
                nowPlayer.moves = temp;
                if (temp != 0)
                {
                    m_passCount = 0;
                    while (temp > 0)
                    {
                        pos = cppWrapper.ConvertMoveBit(temp);
                        e.Graphics.DrawString("×", m_ft, Brushes.DarkOrange,
                            (pos / BOARD_SIZE) * m_mass_size + canmove_x,
                            (pos % BOARD_SIZE) * m_mass_size + canmove_y);
                        temp ^= (1UL << pos);
                    }
                }
            }
            else if (m_mode == ON_HINT && m_hintList.Count > 0 && m_cpuFlagProperty == false)
            {
                // 記憶したヒントを表示
                int attr, eval;
                bool first;

                if (m_hintList.Count > 1) first = true; // 探索後の表示のため
                else first = false;

                foreach (var data in m_hintList)
                {
                    attr = data[0];
                    pos = data[1];
                    eval = data[2];

                    if (attr == HintClass.SOLVE_MIDDLE)
                    {
                        dispMiddleEval(e, pos, eval, first);
                    }
                    else if (attr == HintClass.SOLVE_WLD)
                    {
                        dispWldEval(e, pos, eval, first);
                    }
                    else
                    {
                        dispExactEval(e, pos, eval, first);
                    }
                    first = false;
                }
            }
            textBox1.Text = String.Format("0x{0:x}, 0x{1:x}",
                       boardclass.GetBlack(), boardclass.GetWhite());
        }
Beispiel #2
0
 private void ChangePlayer()
 {
     nowColor = boardclass.GetNowColor();
     nowPlayer = playerArray[nowColor];
     if (nowColor == COLOR_BLACK)
     {
         label1.BackColor = Color.PowderBlue;
         label2.BackColor = Control.DefaultBackColor;
     }
     else
     {
         label2.BackColor = Color.PowderBlue;
         label1.BackColor = Control.DefaultBackColor;
     }
 }
Beispiel #3
0
        private void SetPlayerInfo()
        {
            if (comboBox1.SelectedIndex == 0)
            {
                playerArray[0] = new Player(Player.PLAYER_HUMAN, COLOR_BLACK);
            }
            else
            {
                playerArray[0] = new Player(Player.PLAYER_CPU, COLOR_BLACK);
            }
            if (comboBox2.SelectedIndex == 0)
            {
                playerArray[1] = new Player(Player.PLAYER_HUMAN, COLOR_WHITE);
            }
            else
            {
                playerArray[1] = new Player(Player.PLAYER_CPU, COLOR_WHITE);
            }

        }
Beispiel #4
0
        public Form1()
        {
            boardclass = new BoardClass();

            cpuClass = new CpuClass[2];
            cpuClass[0] = new CpuClass(); // BLACK
            cpuClass[1] = new CpuClass(); // WHITE

            delegateObj = new SetMoveProperty(setMove);
            nodeCountDelegate = new SetNodeCountProperty(setNodeCount);
            cpuMessageDelegate = new SetCpuMessageProperty(setCpuMessage);
            setPVLineDelegate = new SetCpuMessageProperty(setPVLine);
            setMPCInfoDelegate = new SetCpuMessageProperty(setMPCInfo);
            hintDelegate = new DoHintProperty(doHintProcess);

            boardclass.InitBoard(COLOR_BLACK);

            InitializeComponent();
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 3;

            // プレイヤー情報を初期化
            playerArray = new Player[2];
            playerArray[COLOR_BLACK] = new Player(Player.PLAYER_HUMAN, COLOR_BLACK);
            playerArray[COLOR_WHITE] = new Player(Player.PLAYER_CPU, COLOR_WHITE);

            // デフォルトプレイヤー
            nowPlayer = playerArray[COLOR_BLACK];
            if (nowColor == COLOR_BLACK)
            {
                label1.BackColor = Color.PowderBlue;
                label2.BackColor = Control.DefaultBackColor;
            }
            else
            {
                label2.BackColor = Color.PowderBlue;
                label1.BackColor = Control.DefaultBackColor;
            }

            // 探索時間表示用
            m_sw = new Stopwatch();

            // ヒント表示用
            m_hintList = new List<int[]>();

        }