Пример #1
0
        private void HumanVSAi3x3_Btn_Click(object sender, EventArgs e)
        {
            RoleMgr           = new RoleMgr(this, GameDef.PlayerType.Human1, GameDef.PlayerType.AI3X3, GameDef.JudgeType.Nomal);
            HomePanel.Visible = false;

            GameDef.board_cell_length = 4;
            GameDef.win_count         = 4;

            RoleMgr.Start();
        }
Пример #2
0
        private void HumanVSHardAi_Btn_Click(object sender, EventArgs e)
        {
            DisableComputerNextBtn();
            EnableChangeComputerPlayBtn();
            DisableLoadBoardBtn();

            RoleMgr           = new RoleMgr(this, GameDef.PlayerType.Human1, GameDef.PlayerType.HardAI, GameDef.JudgeType.Nomal);
            HomePanel.Visible = false;
            RoleMgr.Start();
        }
Пример #3
0
        private void ReturnHomeBtn_Click(object sender, EventArgs e)
        {
            if (RoleMgr != null)
            {
                ReturnHomeCommand returnHomeCommand = new ReturnHomeCommand("ReturnHomeCommand");
                RoleMgr.onCommand(returnHomeCommand);

                HomePanel.Visible = true;
                RoleMgr           = null;

                DisableComputerNextBtn();
                DisableChangeComputerPlayBtn();
            }
        }
Пример #4
0
        private void AIVSAI_Btn_Click(object sender, EventArgs e)
        {
            DisablePreviousActionBtn();
            DisableChangeComputerPlayBtn();
            DisableLoadBoardBtn();

            GameDef.JudgeType judgeType = GameDef.JudgeType.Nomal;

            if (judgeType == GameDef.JudgeType.Debug)
            {
                EnableComputerNextBtn();
            }
            else
            {
                DisableComputerNextBtn();
            }

            RoleMgr           = new RoleMgr(this, GameDef.PlayerType.EasyAI, GameDef.PlayerType.HardAI, judgeType);
            HomePanel.Visible = false;
            RoleMgr.Start();
        }
Пример #5
0
        public static RoleBase CreateJudge(GameDef.JudgeType type, String name, Form1 view, Model model, RoleMgr roleMgr, ChessType chessType)
        {
            Console.WriteLine($"Create a {type.ToString()} Judge. ChessType is {chessType}");

            switch (type)
            {
            case GameDef.JudgeType.Nomal:
                return(new Judge(name, view, model, roleMgr, chessType));

                break;

            case GameDef.JudgeType.Debug:
                return(new DebugJudge(name, view, model, roleMgr, chessType));

                break;

            default:
                return(null);

                break;
            }
        }
Пример #6
0
        public static Player CreatePlayer(GameDef.PlayerType type, Form1 view, Model model, RoleMgr roleMgr, ChessType chessType)
        {
            Console.WriteLine($"Create a {type.ToString()} Player. ChessType is {chessType}");

            switch (type)
            {
            case GameDef.PlayerType.Human1:
                return(new HumanPlayer("Human1 " + chessType, view, model, roleMgr, chessType));

                break;

            case GameDef.PlayerType.Human2:
                return(new HumanPlayer("Human2 " + chessType, view, model, roleMgr, chessType));

                break;

            case GameDef.PlayerType.EasyAI:
                return(new EasyComputerPlayer("EasyAI " + chessType, view, model, roleMgr, chessType));

                break;

            case GameDef.PlayerType.MediumAI:
                return(new MinMaxComputerPlayer("MediumAI " + chessType, view, model, roleMgr, chessType, 1));

                break;

            case GameDef.PlayerType.HardAI:
                return(new MinMaxComputerPlayer("HardAI " + chessType, view, model, roleMgr, chessType, 3));

                break;

            case GameDef.PlayerType.AI3X3:
                return(new AIComputer3X3Player("AI3X3 " + chessType, view, model, roleMgr, chessType));

                break;

            case GameDef.PlayerType.RandomAI:
                return(new RandomComputerPlayer("RandomAI " + chessType, view, model, roleMgr, chessType));

                break;

            default:
                return(null);

                break;
            }
        }