예제 #1
0
    private static double AI_GetPlayerScore(BoardState State, int playerID)
    {
        double score = 0;
        int opponentID;

        int heroHealth = State.GetCardHealth(State.GetCard(State.GetHeroID(playerID)));
        score += heroHealth * 0.5;

        if (playerID == 0)
            opponentID = 1;
        else
            opponentID = 0;

        int enemyHeroHealth = State.GetCardHealth(State.GetCard(State.GetHeroID(opponentID)));

        score = score - 0.65 * enemyHeroHealth;

        List<Card> boardCards = State.GetPlayerOnBoardMinions(playerID);
        foreach (Card card in boardCards)
        {
            int cardHealth = State.GetCardHealth(card);
            int cardAttack = State.GetCardAttack(card);

            score += 0.8 * cardHealth + 0.7 * cardAttack;
        }

        List<Card> enemyBoardCards = State.GetPlayerOnBoardMinions(opponentID);
        foreach (Card card in enemyBoardCards)
        {
            int cardHealth = State.GetCardHealth(card);
            int cardAttack = State.GetCardAttack(card);

            score = score - 2.0 * (cardAttack + cardHealth);
        }

        if (heroHealth < 1)
            score = Mathf.NegativeInfinity;
        if (enemyHeroHealth < 1)
            score = Mathf.Infinity;

        return score;
    }