Example #1
0
        public override void Update(float dt)
        {
            if (!flagGameOver)
            {
                if (!gameState.CheckGameOver())
                {
                    Command command1 = huPlayer.GetCommand();
                    Command command2 = null;

                    if (debugAIPerTurn)
                    {
                        command2       = aiPlayer.GetCommand();
                        debugAIPerTurn = false;
                    }
                    gameState.AddCommand(command1);
                    gameState.AddCommand(command2);

                    gameState.Cycle(dt);

                    if (gameState.CurrentPlayerId == 1)
                    {
                        decoRect = new Rectangle(Width - 256, 0, 256, 128);
                    }
                    else
                    {
                        decoRect = new Rectangle(Width - 256, Height - 128, 256, 128);
                    }
                }
                else
                {
                    //calculate score
                    //gameState.UpdateScores();
                    gameState.UnionFindAlgorithm();


                    //re-learning if need
                    //huPlayer.GameOver(gameState.GetWinners());
                    //aiPlayer.GameOver(gameState.GetWinners());

                    huPlayer.GameOver(gameState.GetWinner());
                    //testAIPlayer.GameOver(gameState.GetWinner());
                    aiPlayer.GameOver(gameState.GetWinner());

                    testMatches++;



                    //Reset();
                }
            }
        }