Example #1
0
        public CardInfo GetEachUserOpenHandInfo(int key, int gu)
        {
            PK_Card popCard = this.afterSelectedPlayerOpenHandList[key][gu];

            CardInfo temp = this.playerHandEvaluator.CheckMyHandOpenCard(key, popCard, gu);

            return(temp);
        }
Example #2
0
 public int RemoveTempHand(int key, PK_Card card)
 {
     for (int i = 0; i < beforeSelectedHandList[key].Count; i++)
     {
         if (beforeSelectedHandList[key][i].MyShape == card.MyShape &&
             beforeSelectedHandList[key][i].MyValue == card.MyValue)
         {
             this.beforeSelectedHandList[key].RemoveAt(i);
             return(i);
         }
     }
     return(-1);
 }
Example #3
0
        public CardInfo GetEachUserTotalHandInfo(int key, int gu)
        {
            if (this.afterSelectedPlayerTotalHandList.ContainsKey(key)) //key 가 있으면
            {
                PK_Card popCard = this.afterSelectedPlayerTotalHandList[key][gu];

                CardInfo temp = this.playerTotalHandEvaluator.CheckMyHandOpenCard(key, popCard, gu);

                return(temp);
            }
            else //키가 없으면.
            {
                return(null);
            }
        }
Example #4
0
        public CardInfo CountShapeNumber(CardInfo myCardInfo, PK_Card popCard)
        {
            if (popCard.MyShape == (short)PK_Card.SHAPE.HEARTS)
            {
                myCardInfo.heartsSum++;
            }
            else if (popCard.MyShape == (short)PK_Card.SHAPE.DIAMONDS)
            {
                myCardInfo.diamondsSum++;
            }
            else if (popCard.MyShape == (short)PK_Card.SHAPE.CLUBS)
            {
                myCardInfo.clubSum++;
            }
            else if (popCard.MyShape == (short)PK_Card.SHAPE.SPADES)
            {
                myCardInfo.spadesSum++;
            }

            return(myCardInfo);
        }
Example #5
0
 public void CopyTempHandToPlyerOpenHand(int key, PK_Card openCard)
 {
     try
     {
         if (this.afterSelectedPlayerOpenHandList.ContainsKey(key)) //key 가 있으면
         {
             this.afterSelectedPlayerOpenHandList[key].Add(openCard);
             //return this.beforeSelectedEachUserHandList[key];
         }
         else //키가 없으면.
         {
             List <PK_Card> temp = new List <PK_Card>();
             this.afterSelectedPlayerOpenHandList.Add(key, temp);
             this.afterSelectedPlayerOpenHandList[key].Add(openCard);
         }
     }
     catch (System.Exception e)
     {
         Console.WriteLine(e.Message);  // 예외의 메시지를 출력
         Console.WriteLine(e.StackTrace);
     }
 }
Example #6
0
        }                                                 //getg curren Deck


        public void setUpDeck()
        {
            try
            {
                for (int i = 0; i < NUM_OF_SHAPE; i++)
                {
                    for (int j = 2; j < NUM_OF_CARDS; j++)
                    {
                        deck[i * (NUM_OF_CARDS - 2) + (j - 2)] = new PK_Card {
                            MyShape = (short)i, MyValue = (short)j
                        };
                        initDeck[i * (NUM_OF_CARDS - 2) + (j - 2)] = new PK_Card {
                            MyShape = (short)i, MyValue = (short)j
                        };
                    }
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);  // 예외의 메시지를 출력
                Console.WriteLine(e.StackTrace);
            }
            ShuffleCads();
        }
Example #7
0
        public CardInfo CheckMyHandOpenCard(int playerIndex, PK_Card popCard, int curGu)
        {
            this.curHandInfo[playerIndex] = CountShapeNumber(this.curHandInfo[playerIndex], popCard);

            if (this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] == 0) //초기
            {
                this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] = 1;
                CompareCurCardToBeforeCardInOpenCard(playerIndex, popCard.MyValue, popCard.MyShape, HAND.Nothig);

                if (curGu > 3) // 5구부터 검사함. 계산량 줄이기.
                {
                    if (RoyalStraightFlush(playerIndex))
                    {
                        int hightShape = this.curHandInfo[playerIndex].handCardShape[this.maxCard];
                        CompareCurCardToBeforeCardInOpenCard(playerIndex, this.maxCard, hightShape, HAND.RoyalStraightFlush);
                    }
                    else if (StraightFlush(playerIndex))
                    {
                        int hightShape = this.curHandInfo[playerIndex].handCardShape[this.maxCard];
                        CompareCurCardToBeforeCardInOpenCard(playerIndex, this.maxCard, hightShape, HAND.StraightFlush);
                    }
                    else if (Flush(playerIndex))
                    {
                        this.curHandInfo[playerIndex].maxHighCard = SearchIndexForFlushSituation(playerIndex);
                        int hightShape = this.curHandInfo[playerIndex].handCardShape[this.curHandInfo[playerIndex].maxHighCard];
                        CompareCurCardToBeforeCardInOpenCard(playerIndex, this.curHandInfo[playerIndex].maxHighCard, hightShape, HAND.Flush);
                    }
                    else if (Straight(playerIndex))
                    {
                        int hightShape = this.curHandInfo[playerIndex].handCardShape[this.maxCard];
                        CompareCurCardToBeforeCardInOpenCard(playerIndex, this.maxCard, hightShape, HAND.Straight);
                    }
                }
            }

            else if (this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] == 1 && curGu > 0) // 원페어가 되는 경우
            {
                if (this.curHandInfo[playerIndex].onePairFlag)                                        // 원페어기 때문에 투페어가 될 확률이 있다.
                {
                    this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] = 2;                // 투페어가 되는경우
                    CompareCurCardToBeforeCardInOpenCard(playerIndex, popCard.MyValue, popCard.MyShape, HAND.TwoPairs);
                    this.curHandInfo[playerIndex].twoPairFlag = true;
                }
                else
                {
                    this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] = 2;
                    CompareCurCardToBeforeCardInOpenCard(playerIndex, popCard.MyValue, popCard.MyShape, HAND.OnePair);
                    this.curHandInfo[playerIndex].onePairFlag = true;

                    if (curGu > 3)
                    {
                        if (RoyalStraightFlush(playerIndex))
                        {
                            int hightShape = this.curHandInfo[playerIndex].handCardShape[this.maxCard];
                            CompareCurCardToBeforeCardInOpenCard(playerIndex, this.maxCard, hightShape, HAND.RoyalStraightFlush);
                        }
                        else if (StraightFlush(playerIndex))
                        {
                            int hightShape = this.curHandInfo[playerIndex].handCardShape[this.maxCard];
                            CompareCurCardToBeforeCardInOpenCard(playerIndex, this.maxCard, hightShape, HAND.StraightFlush);
                        }
                        else if (Flush(playerIndex))
                        {
                            this.curHandInfo[playerIndex].maxHighCard = SearchIndexForFlushSituation(playerIndex);
                            int hightShape = this.curHandInfo[playerIndex].handCardShape[this.curHandInfo[playerIndex].maxHighCard];
                            CompareCurCardToBeforeCardInOpenCard(playerIndex, this.curHandInfo[playerIndex].maxHighCard, hightShape, HAND.Flush);
                        }
                        else if (Straight(playerIndex))
                        {
                            int hightShape = this.curHandInfo[playerIndex].handCardShape[this.maxCard];
                            CompareCurCardToBeforeCardInOpenCard(playerIndex, this.maxCard, hightShape, HAND.Straight);
                        }
                    }
                }
            }

            else if (this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] == 2 && curGu > 1) //트리플이 되는 경우
            {
                if (this.curHandInfo[playerIndex].twoPairFlag)                                        // 투페어가 있기때문에 풀 하우스
                {
                    this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] = 3;
                    CompareCurCardToBeforeCardInOpenCard(playerIndex, popCard.MyValue, popCard.MyShape, HAND.FullHouse);
                }
                else if (this.curHandInfo[playerIndex].onePairFlag) //원페어가 있기 때문에 쓰리페어
                {
                    this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] = 3;
                    CompareCurCardToBeforeCardInOpenCard(playerIndex, popCard.MyValue, popCard.MyShape, HAND.ThreeKind);
                    this.curHandInfo[playerIndex].threePairFlag = true;
                }
            }
            else if (this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] == 3 && curGu > 2) //포카드 되는 경우
            {
                if (this.curHandInfo[playerIndex].threePairFlag)                                      //쓰리카드가 있기 때문에
                {
                    this.curHandInfo[playerIndex].handCardNumber[popCard.MyValue] = 4;
                    CompareCurCardToBeforeCardInOpenCard(playerIndex, popCard.MyValue, popCard.MyShape, HAND.FourKind);
                }
            }

            return(this.curHandInfo[playerIndex]);
        }
Example #8
0
        public PK_Card getCard(int index)
        {
            PK_Card Card = initDeck[index];

            return(Card);
        }