Beispiel #1
0
 public Card(CardNumEnum number, CardShapeEnum shape)
 {
     this.number    = number;
     this.shape     = shape;
     this.side      = CardSideEnum.DOWN;
     this.imageFace = ImageCutter.GetFaceImage(this);
     this.imageBack = ImageCutter.GetBackImage();
     this.state     = CardState.HAND;
 }
Beispiel #2
0
        private void ResultARound()
        {
            // Find The Strongest
            int theStrongest = this.firstPlayer;

            CardShapeEnum fShape = this.table.GetWhatOnTable(theStrongest).Shape;
            CardNumEnum   fNum   = this.table.GetWhatOnTable(theStrongest).Number;

            for (int i = 0; i < 4; i++)
            {
                if (this.table.GetWhatOnTable(i).Shape == fShape)
                {
                    CardNumEnum tempNumber = this.table.GetWhatOnTable(i).Number;
                    if (tempNumber == CardNumEnum.ACE || tempNumber > fNum)
                    {
                        fNum         = tempNumber;
                        theStrongest = i;
                        if (fNum == CardNumEnum.ACE)
                        {
                            break;
                        }
                    }
                }
            }

            // Calculate Scores
            int scoreOfThisRound = this.table.SumOfScoreCard();

            // Add scores
            if (scoreOfThisRound == 26)                 // Shoot the moon
            {
                for (int i = 0; i < 4; i++)
                {
                    if (i == theStrongest)
                    {
                        continue;
                    }
                    this.players[i].AddScore(26);
                }
            }
            else
            {
                this.players[theStrongest].AddScore(scoreOfThisRound);
            }

            // Who's Next
            this.currentPlayer = theStrongest;
        }
Beispiel #3
0
 // 손에서 카드를 제거(카드를 냄)
 public Card RemoveFromHand(CardShapeEnum shape, CardNumEnum num)
 {
     try
     {
         foreach (Card card in this.cardList)
         {
             if (card.Shape == shape && card.Number == num)
             {
                 Card temp = card;
                 this.cardList.Remove(card);
                 return(temp);
             }
         }
         throw new Exception("RemoveFromHand() error");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(null);
     }
 }
Beispiel #4
0
        public Manager()
        {
            this.players = new Player[4];
            players[0]   = new Player("A");
            players[1]   = new Player("B");
            players[2]   = new Player("C");
            players[3]   = new Player("D");

            this.cards = new Card[4, 13];
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 13; j++)                    // 카드 생성
                {
                    CardNumEnum   num   = (CardNumEnum)((int)CardNumEnum.ACE + j);
                    CardShapeEnum shape = (CardShapeEnum)((int)CardShapeEnum.SPADE + i);
                    cards[i, j] = new Card(num, shape);
                }
            }

            this.table           = new Table();
            this.selectedExCards = new Card[4, 3];
            this.exThreads       = new Thread[4];
            this.exChecker       = false;
        }