Beispiel #1
0
    public string ComputeCommand()
    {
        var grid    = gameState.grid;
        var me      = gameState.me;
        var enemy   = gameState.enemy;
        var myItems = gameState.GetItems(playerId: 0);
        var myTile  = me.tile;

        int bestScore = 0;

        Random      rand            = new Random();
        PushCommand bestPushCommand = new PushCommand(rand.Next(0, 6), (Direction)rand.Next(0, 4));

        List <PushCommand> pushCommands = ComputeAllPossibleCommands();

        foreach (var pushCommand1 in pushCommands)
        {
            //XmasRush.Debug("****************************************");
            //XmasRush.Debug($"Evaluate {pushCommand1.ToString()}");

            var newGameState1 = gameState.Evaluate(pushCommand1);
            var score         = newGameState1.ComputeScore(gameState);

            //XmasRush.Debug($"score: {score.ToString()}");

            if (score > bestScore)
            {
                bestScore       = score;
                bestPushCommand = pushCommand1;
            }
        }

        return(bestPushCommand.ToString());
    }