コード例 #1
0
ファイル: Form1.cs プロジェクト: ScottFBasham/Pontoon
 private void shuffle()
 {
     for (int i = 51; i > 0; i--)
     {
         //swap a random card (located below i) with position i
         int         swapPosition = myRandom.Next(i);
         PlayingCard temp         = deck[i];
         deck[i]            = deck[swapPosition];
         deck[swapPosition] = temp;
     }
     deckPosition = 0;
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ScottFBasham/Pontoon
        private void frmPontoon_Load(object sender, EventArgs e)
        {
            // initialise deck
            for (int i = 0; i < 52; i++)
            {
                deck[i] = new PlayingCard(i);
            }
            playerGrpBox[0] = grpPCard1;
            playerGrpBox[1] = grpPCard2;
            playerGrpBox[2] = grpPCard3;
            playerGrpBox[3] = grpPCard4;
            playerGrpBox[4] = grpPCard5;
            bankerGrpBox[0] = grpBCard1;
            bankerGrpBox[1] = grpBCard2;
            bankerGrpBox[2] = grpBCard3;
            bankerGrpBox[3] = grpBCard4;
            bankerGrpBox[4] = grpBCard5;
            playerPic[0]    = picPCard1;
            playerPic[1]    = picPCard2;
            playerPic[2]    = picPCard3;
            playerPic[3]    = picPCard4;
            playerPic[4]    = picPCard5;
            bankerPic[0]    = picBCard1;
            bankerPic[1]    = picBCard2;
            bankerPic[2]    = picBCard3;
            bankerPic[3]    = picBCard4;
            bankerPic[4]    = picBCard5;
            playerCard[0]   = lblPCard1;
            playerCard[1]   = lblPCard2;
            playerCard[2]   = lblPCard3;
            playerCard[3]   = lblPCard4;
            playerCard[4]   = lblPCard5;
            bankerCard[0]   = lblBCard1;
            bankerCard[1]   = lblBCard2;
            bankerCard[2]   = lblBCard3;
            bankerCard[3]   = lblBCard4;
            bankerCard[4]   = lblBCard5;

            picSource[0] = picClub;
            picSource[1] = picDiamond;
            picSource[2] = picHeart;
            picSource[3] = picSpade;

            shuffle();
        }