Exemple #1
0
        public void Down(AbstractStone stone)                                                   //按棋子落子
        {
            stone.Down();                                                                       //落子

            MainForm.lstHistory.Items.Add(stone);
            MainForm.lstHistory.SelectedIndex = MainForm.lstHistory.Items.Count - 1;            //添加记录,列表中选中最后一个棋子
            Draw(MainForm.picBoard.CreateGraphics());                                           //窗体重绘

            if ((NetInputer != null) && !(CurrentPlayer is NetPlayer))
            {
                NetInputer(stone.X, stone.Y);                                                   //网络发送棋子
            }
            CurrentTag = Divert(CurrentTag);                                                    //玩家换手

            if (!bIsVideo)                                                                      //如果非录像
            {
                double nValue = Analyzer.GetValue(Board, stone);                                //估值是否获胜
                if (nValue > Constants.WIN - Constants.DELTA)
                {
                    GiveUp(); return;
                }                                                                               //对方获胜,则己方弃权
                if (MainForm.lstHistory.Items.Count == Constants.MAX_STONE)
                {
                    MainForm.StopGame();                                                        //双方下满格子,平局
                }
                else
                {
                    CurrentPlayer.Play();                                                       //对方开始下棋
                }
            }
        }
Exemple #2
0
 public static double GetValue(Tag[,] Board, AbstractStone stone)            //估值
 {
     return(GetValue(Board, stone.X, stone.Y));
 }