Ejemplo n.º 1
0
        public void ResetDeck(int DeckNum)
        {
            if (DeckNum == 1)
            {
                int deck1count = deck1.Count;
                for (int i = deck1count-1; i >= 0; i--)
                    deck1.Deal(i);

                Deck decktoDeal;
                List<Card> cardsofDeck1 = new List<Card>();
                decktoDeal = new Deck();
                Random random = new Random();
                int Deck1Count = random.Next(1, 11);
                for (int i = 0; i < Deck1Count; i++)
                    cardsofDeck1.Add(decktoDeal.Deal(random.Next(decktoDeal.Count)));
                deck1 = new Deck(cardsofDeck1);
                deck1.Sort();
                RedrawDeck(1);
            }
            else
            {
                int deck2count = deck2.Count;
                for (int deck2index = deck2count - 1; deck2index >= 0; deck2index--)
                    deck2.Deal(deck2index);

                deck2 = new Deck();
                deck2.Sort();
                RedrawDeck(2);
            }
        }
Ejemplo n.º 2
0
        public Form1()
        {
            Deck        decktoDeal;
            List <Card> cardsofDeck1 = new List <Card>();

            decktoDeal = new Deck();
            Random random     = new Random();
            int    Deck1Count = random.Next(1, 11);

            for (int i = 0; i < Deck1Count; i++)
            {
                cardsofDeck1.Add(decktoDeal.Deal(random.Next(decktoDeal.Count)));
            }
            deck1 = new Deck(cardsofDeck1);
            deck1.Sort();
            //RedrawDeck(1);
            deck2 = new Deck();
            deck2.Sort();
            //RedrawDeck(2);
            InitializeComponent();
            foreach (string cardName in deck1.GetCardName())
            {
                listBox1.Items.Add(cardName);
            }
            label1.Text = "Deck #1(" + deck1.Count + " cards)";

            foreach (string cardName in deck2.GetCardName())
            {
                listBox2.Items.Add(cardName);
            }
            label2.Text            = "Deck #2(" + deck2.Count + " cards)";
            listBox1.SelectedIndex = 0;
            listBox2.SelectedIndex = 0;
        }
Ejemplo n.º 3
0
        public Form1()
        {
            Deck decktoDeal;
            List<Card> cardsofDeck1 = new List<Card>();
            decktoDeal = new Deck();
            Random random = new Random();
            int Deck1Count = random.Next(1,11);
            for (int i = 0; i < Deck1Count; i++)
                cardsofDeck1.Add(decktoDeal.Deal(random.Next(decktoDeal.Count)));
            deck1 = new Deck(cardsofDeck1);
            deck1.Sort();
            //RedrawDeck(1);
            deck2 = new Deck();
            deck2.Sort();
            //RedrawDeck(2);
            InitializeComponent();
            foreach (string cardName in deck1.GetCardName())
                listBox1.Items.Add(cardName);
            label1.Text = "Deck #1(" + deck1.Count + " cards)";

            foreach (string cardName in deck2.GetCardName())
                listBox2.Items.Add(cardName);
            label2.Text = "Deck #2(" + deck2.Count + " cards)";
            listBox1.SelectedIndex = 0;
            listBox2.SelectedIndex = 0;
        }
Ejemplo n.º 4
0
        public void ResetDeck(int DeckNum)
        {
            if (DeckNum == 1)
            {
                int deck1count = deck1.Count;
                for (int i = deck1count - 1; i >= 0; i--)
                {
                    deck1.Deal(i);
                }


                Deck        decktoDeal;
                List <Card> cardsofDeck1 = new List <Card>();
                decktoDeal = new Deck();
                Random random     = new Random();
                int    Deck1Count = random.Next(1, 11);
                for (int i = 0; i < Deck1Count; i++)
                {
                    cardsofDeck1.Add(decktoDeal.Deal(random.Next(decktoDeal.Count)));
                }
                deck1 = new Deck(cardsofDeck1);
                deck1.Sort();
                RedrawDeck(1);
            }
            else
            {
                int deck2count = deck2.Count;
                for (int deck2index = deck2count - 1; deck2index >= 0; deck2index--)
                {
                    deck2.Deal(deck2index);
                }

                deck2 = new Deck();
                deck2.Sort();
                RedrawDeck(2);
            }
        }