private void button1_Click(object sender, EventArgs e)
        {
            cmbFigure.Visible = true;
            btncheck.Visible  = true;
            game = new Boxes(new GraphicsCardSet(pnlDeck, 36),
                             MarkAcPlayer, MarkPasPlayer, ShowMessage,
                             new GraphicsPlayer("Bob", new GraphicsCardSet(pnlPlayer1), lbl1),
                             new GraphicsPlayer("Tom", new GraphicsCardSet(pnlPlayer2), lbl2),
                             new GraphicsPlayer("Jack", new GraphicsCardSet(pnlPlayer3), lbl3),
                             new GraphicsPlayer("Max", new GraphicsCardSet(pnlPlayer4), lbl4));

            game.Deal();
            button1.Enabled = false;
        }
Exemple #2
0
        public void StartModernConveyor()
        {
            Boxes.Add(new Box());

            while (true)
            {
                double weight;

                Item item;
                if (Items.Count == 0)
                {
                    weight = FractionUI.EnterFraction();
                    item   = new Item(weight);
                }
                else
                {
                    item = new Item(Items[0].Weight);
                    Items.RemoveAt(0);
                }

                bool checkBox = false;
                foreach (var box in Boxes)
                {
                    checkBox = box.CheckCapacity(item);
                    if (checkBox)
                    {
                        box.PutItem(item);
                        break;
                    }
                }

                if (!checkBox)
                {
                    var box = new Box();
                    box.PutItem(item);
                    Boxes.Add(box);
                }

                foreach (var box in Boxes)
                {
                    Console.WriteLine(box.ToString());
                }
            }
        }
Exemple #3
0
        public void StartUsualConveyor()
        {
            Boxes.Add(new Box());
            var boxIndex = 0;

            while (true)
            {
                double weight;

                Item item;
                if (Items.Count == 0)
                {
                    weight = FractionUI.EnterFraction();
                    item   = new Item(weight);
                }
                else
                {
                    item = new Item(Items[0].Weight);
                    Items.RemoveAt(0);
                }

                bool check = Boxes[boxIndex].CheckCapacity(item);

                if (!check)
                {
                    Boxes.Add(new Box());
                    boxIndex++;
                }

                Boxes[boxIndex].PutItem(item);

                foreach (var box in Boxes)
                {
                    Console.WriteLine(box.ToString());
                }
            }
        }