Exemplo n.º 1
0
    void Start()
    {
//		string st = "";
//		for (int i = 0; i < 52; i++) {
//			PhomCard pCard = new PhomCard (i);
//			st += " " + pCard.ToString ();
//		}
//		Debug.Log (st);
//
//		PhomCard pc = new PhomCard ("TC");
//		Debug.Log (pc.ToIndex ());

//		PhomCombination comb = new PhomCombination ("AS AH AD 2D 3D 7H 9D TD JD QD KS KH KC");
//		Debug.Log (comb.GetTypeName ());
        PhomCard c  = new PhomCard("TC");
        PhomCard c2 = new PhomCard("4C");

        Debug.Log(c.GetRank() + " " + c2.GetRank());

        PhomHand hand = new PhomHand();

        hand.AddCards("AS AH 2C 2D 3C KS QH KH KC KD");
//		hand.FindCombinations ();
//		hand.Arrange ();
        Debug.Log("Best:" + hand.Best());
    }
Exemplo n.º 2
0
    /// <summary>
    /// Khi có người chơi bốc bài
    /// </summary>
    /// <param name="index">Người bốc bài</param>
    /// <param name="cardValue">Bài bốc được</param>
    public static void DrawCard(int index, int cardValue)
    {
        if (index != YourController.slotServer)
        {
            if (!Common.CanViewHand)
            {
                cardValue = -1;
            }
        }

        PhomCard card = new PhomCard(index, cardValue);

        card.Instantiate();
        GetPlayer(index).mCardHand.Add(card);

        DeckCount--;
        if (YourController.slotServer == index)
        {
            game.canRequestSort = true;
        }
        game.stolen = false;

        MiniState = EGameStateMini.discard;

        if (Common.CanViewHand && YourController.slotServer != index)
        {
            GetPlayer(index).mCardHand.Sort((c1, c2) => c1.CompareTo(c2));
        }

        game.UpdateHand(index, 0.5f);
        game.UpdateHand(GameModelPhom.IndexLastInTurn, 0.5f);

        card.UpdateParent(index);
    }
Exemplo n.º 3
0
    public CardSet FindRankSetCombination(PhomCard card)
    {
        CardSet combination = new CardSet();

        foreach (PhomCard c in cards)
        {
            if (card.HasSameRank(c))
            {
                combination.AddCard(c);
            }
        }

        if (combination.Length() <= 2)
        {
            combination.Reset();
        }
        else
        {
            combination.Sort(Order.ASC);
        }
        return(combination);
    }
Exemplo n.º 4
0
    public CardSet FindStraightCombination(PhomCard card)
    {
        CardSet combination = new CardSet();
        int     topRank     = card.GetRank();
        int     bottomRank  = topRank;
        int     index       = cards.IndexOf(card);

        for (int i = index - 1; i >= 0; i--)
        {
            if (card.HasSameSuit(cards [i]) && cards [i].GetRank() == bottomRank - 1)
            {
                combination.AddCard(cards [i]);
                bottomRank--;
            }
        }

        combination.AddCard(card);

        for (int i = index + 1; i < cards.Count; i++)
        {
            if (card.HasSameSuit(cards [i]) && cards [i].GetRank() == topRank + 1)
            {
                combination.AddCard(cards [i]);
                topRank++;
            }
        }

        if (combination.Length() <= 2)
        {
            combination.Reset();
        }
        else
        {
            combination.Sort(Order.ASC);
        }
        return(combination);
    }
Exemplo n.º 5
0
 public void DropCard(PhomCard card)
 {
 }
Exemplo n.º 6
0
 public bool CanDropCard(PhomCard card)
 {
     return(true);
 }
Exemplo n.º 7
0
 public bool CanTakeCard(PhomCard card)
 {
     return(false);
 }
Exemplo n.º 8
0
 public void TakeCard(PhomCard card)
 {
 }