Пример #1
0
        public doublepeople()
        {
            InitializeComponent();
            int r = 19, c = 10;
            //myGame = new MyGameFrame(myGrid, r, c);
            myGame = new MyGameFrame(myGrid, r, c);

            //myGame.AIInitialize(new SimpleAI(r, c, myGame,new Complex_AI_Integrator()));

            FriendGame = new MyGameFrame(aiGrid, r, c);
            //FriendGame.AIInitialize(new SimpleAI(r, c, FriendGame, new Simple_AI_Integrator()));
            preview = new PreviewWindow(myGame, PreviewImage);
            preview = new PreviewWindow(FriendGame, PreviewImage1);
            //设置计分板
            plarSc = new DoubleScoringBoard(PlayerScoreLabel);
            myGame.RowsCleanEvent += plarSc.GetScore;
            myGame.RowsCleanEvent += Play;
            aiSc = new DoubleScoringBoard(AIScoreLabel);
            FriendGame.RowsCleanEvent += aiSc.GetScore;

            plarSc.Threshold = aiSc.Threshold = 800;

            //增加增行函数的事件绑定
            aiSc.CrossThreshold += myGame.OtherCrossThreshold;
            plarSc.CrossThreshold += FriendGame.OtherCrossThreshold;

            //设置游戏结束
            myGame.GameOverEvent += GameFinish;
            myGame.GameOverEvent += plarSc.WhenGameOver;
            FriendGame.GameOverEvent += GameFinish;
            FriendGame.GameOverEvent += aiSc.WhenGameOver;

        }
Пример #2
0
        public DoublePlayer()
        {
            InitializeComponent();

            int r=19,c=10;
            //myGame = new MyGameFrame(myGrid, r, c);
            myGame = new MyGameFrame(myGrid, r, c);
            
            //myGame.AIInitialize(new SimpleAI(r, c, myGame,new Complex_AI_Integrator()));

            myAIFrame = new AIFrame(aiGrid, r, c);
            myAIFrame.AIInitialize(new SimpleAI(r,c,myAIFrame,new Simple_AI_Integrator()));

            //设置计分板
            plarSc = new DoubleScoringBoard(PlayerScoreLabel);
            myGame.RowsCleanEvent += plarSc.GetScore;
            myGame.RowsCleanEvent += Play;
            aiSc = new DoubleScoringBoard(AIScoreLabel);
            myAIFrame.RowsCleanEvent += aiSc.GetScore;

            plarSc.Threshold = aiSc.Threshold = 800;

            //增加增行函数的事件绑定
            aiSc.CrossThreshold += myGame.OtherCrossThreshold;
            plarSc.CrossThreshold += myAIFrame.OtherCrossThreshold;

            //设置游戏结束
            myGame.GameOverEvent += GameFinish;
            myGame.GameOverEvent += plarSc.WhenGameOver;
            myAIFrame.GameOverEvent += GameFinish;
            myAIFrame.GameOverEvent += aiSc.WhenGameOver;
            //img preview
          PreviewWindow  preview = new PreviewWindow(myGame, playerImg);
          PreviewWindow  preview1 = new PreviewWindow(myAIFrame, aiImg);

        }