Example #1
0
 static int calculate(Pcard banker, Pcard player, int bet)
 {
     if (banker.CompareTo(player) > 0)
     {
         int times = (int)(banker.type == CardType.NO_NIU ? CardType.NORMAL : banker.type);
         return(bet * bottom_score * times);
     }
     else
     {
         int times = (int)(player.type == CardType.NO_NIU ? CardType.NORMAL : player.type);
         return(-bet * bottom_score * times);
     }
 }
Example #2
0
    public int CompareTo(object obj)
    {
        Pcard pcard = obj as Pcard;

        // type compare
        if (this.type > pcard.type)
        {
            return(1);
        }
        else if (this.type < pcard.type)
        {
            return(-1);
        }

        // the normal type
        if (this.type == CardType.NORMAL)
        {
            if (this.point > pcard.point)
            {
                return(1);
            }
            else if (this.point < pcard.point)
            {
                return(-1);
            }
        }

        // if the type is the same, and is not normal type
        if (this.type == CardType.BOOM)
        {
            if (this.max_card > pcard.max_card)
            {
                return(1);
            }
            else
            {
                return(-1);
            }
            Debug.Assert(false);             // 两个炸弹,这牌 出轨了!!!
        }
        if (this.max_card == pcard.max_card)
        {
            return(0);
        }
        else if ((this.max_card % 13) > (pcard.max_card % 13))
        {
            return(1);
        }
        else if ((this.max_card % 13) == (pcard.max_card % 13))
        {
            if ((this.max_card / 13) > (pcard.max_card / 13))
            {
                return(1);
            }
            else
            {
                return(-1);
            }
        }
        else
        {
            return(-1);
        }
    }