コード例 #1
0
ファイル: User.cs プロジェクト: arnoldout/mobileAppsProject
        //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();
            }
        }
コード例 #2
0
ファイル: SkyNet.cs プロジェクト: arnoldout/mobileAppsProject
 //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;
 }
コード例 #3
0
ファイル: SkyNet.cs プロジェクト: arnoldout/mobileAppsProject
 public SkyNet(Card[] crdPool, String name) : base(crdPool, name)
 {
   
 }
コード例 #4
0
ファイル: User.cs プロジェクト: arnoldout/mobileAppsProject
        //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)
        {

        }
コード例 #5
0
 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;
 }
コード例 #6
0
ファイル: Player.cs プロジェクト: arnoldout/mobileAppsProject
 public void addCrd(Card c)
 {
     //the card is added to the table
     onBrd[this.trnCnt] = c;    
 }
コード例 #7
0
ファイル: Player.cs プロジェクト: arnoldout/mobileAppsProject
 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;
 }
コード例 #8
0
ファイル: Player.cs プロジェクト: arnoldout/mobileAppsProject
 //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;
 }