示例#1
0
文件: Main.cs 项目: 24861091/Tamia
 public void Restart(ChessPlayer black, ChessPlayer white)
 {
     BlackPlayersBox.Enabled = false;
     WhitePlayersBox.Enabled = false;
     this.DisplayLabel.Text  = "开始!";
     this.Invalidate();
     if (Utility.IsDebugOpen && !debugForm.Visible)
     {
         debugForm.Show();
     }
 }
示例#2
0
        public void SetChessPlayers(ChessPlayer black, ChessPlayer white)
        {
            //Logger.Log("SetChessPlayers 1");
            this.black = black;
            this.black.SetSide(棋子.黑子);
            this.black.GameStart(panel.Positions);
            //Logger.Log("SetChessPlayers 2");
            this.white = white;
            this.white.SetSide(棋子.白子);
            this.white.GameStart(panel.Positions);
            //Logger.Log("SetChessPlayers 3");
            bool canSend = black.IsHuman() || white.IsHuman();

            this.black.CanSend = true;
            this.white.CanSend = true;
            //Logger.Log("SetChessPlayers 3");
        }
示例#3
0
        public static ChessPlayer CreatePlayer(string typeName)
        {
            string[] s = typeName.Split('_');
            if (s != null)
            {
                Type type = Type.GetType("五子棋.AI." + s[0]);
                if (type != null)
                {
                    ChessPlayer player = Activator.CreateInstance(type) as ChessPlayer;
                    if (s.Length == 2)
                    {
                        player.Name = s[1];
                    }
                    else
                    {
                        player.Name = s[0];
                    }

                    return(player);
                }
            }
            return(null);
        }
示例#4
0
        public DNA[] StartLeague(int generation, int times, int topNum)
        {
            string path = Utility.CreateTargetPath(generation);

            League.Instance.Initialize(path, times);
            League.Instance.Do();
            bool can = true;

            while (can)
            {
                ChessPlayer black = League.Instance.GetBlack();
                ChessPlayer white = League.Instance.GetWhite();
                _rule.Clear();
                _rule.SetChessPlayers(black, white);
                Messager.Instance.SendMessageLater(MessageKey.Restart, new ChessPlayer[] { black, white });
                ChessMove move = StartOneChess();
                can = League.Instance.Finish(move.Side);
            }
            Messager.Instance.SendMessageLater(MessageKey.FinishLeague, null);
            LeagueResult[][] result  = League.Instance.Performance;
            List <DNAPlayer> players = League.Instance.GetPlayers();

            return(Calculate(result, players, topNum));
        }
示例#5
0
 private void StartChess(ChessPlayer black, ChessPlayer white)
 {
 }