Beispiel #1
0
        //called in the deckCall and the handCall methods
        //processes the card generated from deck or hand
        public void playCard(Card c, Boolean stnd, TextBlock tb)
        {
            if (stnd)
            {
                this.Stndng = true;
            }

            if (TrnCnt < 9 && this.Stndng == false&&IsTrn==true)
            {
                //when a card is played (can be deck or hand)
                //card is added to the table
                addCrd(c);
                //turn count is incremented
                TrnCnt++;
                //score is incremented by the value of the card
                CurrScr += c.Val;
                //write the new score to the screen
                tb.Text = this.CurrScr.ToString();
            }
        }
Beispiel #2
0
 //add card to table, increment the turn counter, and adjust the current score accordingly
 private void prcesCrd(Card c)
 {   
     addCrd(c);
     TrnCnt++;
     CurrScr += c.Val;
 }
Beispiel #3
0
 public SkyNet(Card[] crdPool, String name) : base(crdPool, name)
 {
   
 }
Beispiel #4
0
        //User is a Player
        //a user dosnt have its own variables, but it has lots of its own methods

        //base() creates a player object using the super constructor
        public User(Card[] crdPool, String name) : base(crdPool, name)
        {

        }
 private static Card[] createCardPool()
 {
     //an array of cards is created by the addition of i to the count tracker
     Card[] pool = new Card[15];
     int cntTracker = 8;
     for (Int16 i = -8; i < 8; i++)
     {
         //the loop iterates 16 times, it will hit this if statement on 15 occurences 
         if (i != 0)
         {
             Card c = new Card(i);
             pool[i + cntTracker] = c;
         }
         //when i enters into the positive numbers, count tracker is decremented
         //allows the algorithm the ability to reach the final boxes in the array
         else
         {
             cntTracker--;
         }
     }
     //the card pool is returned
     return pool;
 }
Beispiel #6
0
 public void addCrd(Card c)
 {
     //the card is added to the table
     onBrd[this.trnCnt] = c;    
 }
Beispiel #7
0
 public Card[] genHnd(Card [] crdPool)
 {
     Card[] pool = crdPool;
     Card[] hand = new Card[4];
     //4 random cards are pulled from the card pool
     for (int genLoop = 0; genLoop<4; genLoop++)
     {
         int card = App.randomizer.Next(0, pool.Length);
         Card c = pool[card];
         hand[genLoop] = c;
         pool = pool.Except(new Card[] {c }).ToArray();
     }
     return hand;
 }
Beispiel #8
0
 //constructor for a player, it needs a card pool and an identifier
 public Player(Card[] crdPool, String name) {
     this.crdPool = crdPool;
     //hand is populated randomly from the card pool
     this.hand = genHnd(crdPool);
     this.onBrd = new Card[9];
     this.rndsWn = 0;
     this.gmsWn = 0;
     this.trnCnt = 0;
     this.name = name;
     this.currScr = 0;
     this.gotDk = false;
     this.isTrn = true;
     this.isBust = false;
 }