public AIWindow() { InitializeComponent(); game = new AIFrame(gameGrid,19,10); game.AIInitialize(new SimpleAI(19,10, game,new Simple_AI_Integrator())); ScoringBoard sb = new ScoringBoard(Scoring_Board_AI); game.RowsCleanEvent += sb.GetScore; }
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); }
public SimpleAI(int r, int c, AIFrame frame,AI_Integrator ai_Integrator) { this.aiFrame = frame; Init(r, c); integrator = ai_Integrator; }