예제 #1
0
        public void Shuffle(int shuffles = 150)
        {
            var turns = new ShuffleMachine[]
            {
                Transposing, SwapColumnsArea, SwapRowsArea, SwapColumnsArea, SwapRowsSmall, SwapColumnsSmall
            };

            for (var i = 0; i < shuffles; i++)
            {
                var kek = rnd.Next(0, 6);
                turns[kek]();
            }
        }
예제 #2
0
 public Game(List <Player> players, int countOfDecks = 8)
 {
     Players  = players;
     drawer   = new Drawer();
     Croupier = new Croupier();
     Machine  = new ShuffleMachine(countOfDecks);
     Machine.Shuffle();
 }
예제 #3
0
        public void TrowCardTest()
        {
            ShuffleMachine machine = new ShuffleMachine();

            Assert.IsTrue(machine.TrowCard() == new Card(0, 1));
            Assert.IsTrue(machine.TrowCard() == new Card(1, 2));

            Assert.Pass();
        }
예제 #4
0
        public void ShuffleTest()
        {
            ShuffleMachine machine = new ShuffleMachine();

            machine.Shuffle();
            Assert.IsFalse(machine.TrowCard() == new Card(0, 1));
            Assert.IsFalse(machine.TrowCard() == new Card(1, 2));

            Assert.Pass();
        }
예제 #5
0
 public Dealer(Graphics drawing, ShuffleMachine machine)
 {
     this.drawing = drawing;
     this.machine = machine;
     machine.Start();
     for (int i = 0; i < playerHand.Count(); i++)
     {
         playerHand[i] = new CardHand();
     }
     dealerHand  = new CardHand();
     cardDrawing = new CardDrawing(drawing);
     dealTo      = 0;
 }
예제 #6
0
 private void buttonBuyInOK_Click(object sender, EventArgs e)
 {
     try
     {
         money = Convert.ToInt32(textBoxBuyIn.Text);
         if (money < 100)
         {
             money = 100;
         }
         else if (money > 3000)
         {
             money = 3000;
         }
         groupBoxBuyIn.Visible          = false;
         startToolStripMenuItem.Enabled = false;
         textBoxMoney.Text = money.ToString();
         setButtonBoxBidVisible(true);
         buttonStart.Visible = true;
         if (shuffleType == ShuffleType.Machine)
         {
             machine = new ShuffleMachine(4, shuffleType);
         }
         else
         {
             machine = new ShuffleMachine(8, shuffleType);
             machine.CardCountingEvent += UpdateCardCounting;
         }
         dealer                           = new Dealer(drawing, machine);
         dealer.OutPutState              += new OutPutValueHandler(setBoxState);
         dealer.DisplayOptions           += new DisplayOptionsHandler(displayPlayerOptions);
         dealer.FinishHandEvent          += new FinishHandHandler(finishGame);
         settingToolStripMenuItem.Enabled = false;
     }
     catch
     {
         MessageBox.Show("Please input a number between 100~3000");
         textBoxBuyIn.Text = "";
     }
 }
예제 #7
0
 public void GetNewHand(ShuffleMachine machine)
 {
     Cards = new List <Card>();
     Cards.Add(machine.TrowCard());
     Cards.Add(machine.TrowCard());
 }