コード例 #1
0
    public void setHandEvaluated(EvaluatedHand evaluatedhand)
    {
        this.evaluatedhand = evaluatedhand;

        handStrength = HandStrengthEvaluater.Evaluate
                           (evaluatedhand.name, cards, evaluatedhand.Cards, gameManager.gameStatus()) / 100f;
        int rank = HandStrengthEvaluater.rank(evaluatedhand.name);

        handPotential = HandPotentialEvaluater.Evaluate
                            (rank, evaluatedhand.flushPotential, evaluatedhand.straightPotential, gameManager.gameStatus()) / 10f;

        ExecuteEvents.Execute <PlayerHandler> (Player.gameObject, null, (x, y) => x.HandIsEvaluated());
    }
コード例 #2
0
    public int compareTwoHands(PlayerImplementation player1, PlayerImplementation player2)
    {
        int rank1 = HandStrengthEvaluater.rank(player1.evaluatedCards.name);
        int rank2 = HandStrengthEvaluater.rank(player2.evaluatedCards.name);

        string cardsEvaluated1 = "[";

        for (int i = 0; i < player1.evaluatedCards.Cards.Count; i++)
        {
            if (i < player1.evaluatedCards.Cards.Count - 1)
            {
                cardsEvaluated1 += player1.evaluatedCards.Cards [i].CardValue + ",";
            }
            else
            {
                cardsEvaluated1 += player1.evaluatedCards.Cards [i].CardValue + "]";
            }
        }

        string cardsEvaluated2 = "[";

        for (int i = 0; i < player2.evaluatedCards.Cards.Count; i++)
        {
            if (i < player2.evaluatedCards.Cards.Count - 1)
            {
                cardsEvaluated2 += player2.evaluatedCards.Cards [i].CardValue + ",";
            }
            else
            {
                cardsEvaluated2 += player2.evaluatedCards.Cards [i].CardValue + "]";
            }
        }

        string query  = "X:result(" + rank1 + "," + rank2 + "," + cardsEvaluated1 + "," + cardsEvaluated2 + ",X).";
        int    result = int.Parse(UnityExtensionMethods.SolveForParsed(kB, query).ToString());

        return(result);
    }