Exemplo n.º 1
0
        public float GetStateValue(TyState playerState, TyState enemyState, Controller player, Controller opponent, PlayerTask task)
        {
            TyDebug.Assert(IsMyPlayer(player));
            TyDebug.Assert(!IsMyPlayer(opponent));

            if (EstimateSecretsAndSpells)
            {
                TySecretUtil.CalculateValues(playerState, enemyState, player, opponent);
                TySecretUtil.EstimateValues(enemyState, opponent);

                Spell spell = task.TryGetSpell();

                if (spell != null && !spell.IsSecret)
                {
                    TySpellUtil.CalculateValues(playerState, enemyState, player, opponent, task, spell);
                }
            }

            if (HasLost(enemyState))
            {
                return(Single.PositiveInfinity);
            }

            else if (HasLost(playerState))
            {
                return(Single.NegativeInfinity);
            }

            return(GetStateValueFor(playerState, enemyState) - GetStateValueFor(enemyState, playerState));
        }