Exemple #1
0
        public BrandsTest()
        {
            BrandPlayer a = new BrandPlayer();

            BrandFactory x = new BrandFactory();
            x.createBrands();
            x.randomBrands();

            //x.PrintRadomTable(); //�C�X�üƪ�
            a = x.getBrands();

            Iterator ai;
            ai = a.creatIterator(10);
            print(ai);

            ai = a.creatIterator(3);
            a=removefromplayer(ai,a);

            ai = a.creatIterator(10);
            print(ai);

            //Console.WriteLine();
            //Console.Write("{0},{1}\n", sa.getReadyBrand().getClass(),sa.getReadyBrand().getNumber());

            //chackBrands();
            //chackArrayList();

            x.creatImageArray();
        }
Exemple #2
0
 /// <summary>
 /// �إߵP,�ä��t�P
 /// </summary>
 public void creatBrands()
 {
     factory = new BrandFactory();
     factory.createBrands();
     factory.randomBrands();
     all.Table = factory.getBrands();
     for (int i = 0; i < all.Table.getCount(); i++)
         all.Table.getBrand(i).WhoPush = location.Table;
     dealbrands();
 }
Exemple #3
0
        public AiTest()
        {
            BrandPlayer[] player = new BrandPlayer[4];
            BrandPlayer table = new BrandPlayer();

            BrandFactory x = new BrandFactory();
            x.createBrands();
            x.randomBrands();

            table = x.getBrands();

            Deal deal = new Deal(16,table);
            deal.DealBrands();

            player = deal.Player;

            printplayer(player);

            //SimpleAI sa = new SimpleAI();
            //sa.setPlayer(player[0]);
            //PlayerSort bs = new PlayerSort(player[0]);
            //player[0] = bs.getPlayer();

            //PlayerSort bs = new PlayerSort(player[0]);

            PlayerSort bs = new PlayerSort(player[0],new FlowerBrand(0),new TenThousandBrand(0),new RopeBrand(0),new  TubeBrand(0),new WordBrand(0));
            player[0] = bs.getPlayer;
            Level_1 l = new Level_1();
            l.setPlayer(player[0]);
            l.getReadyBrand();

            //printplayer(player);
            //Level_1 l = new Level_1();
            //BrandPlayer test = new BrandPlayer();
            //test.add(new WordBrand(1));
            //test.add(new WordBrand(1));
            //test.add(new WordBrand(1));
            //test.add(new WordBrand(2));
            //test.add(new WordBrand(3));
            //test.add(new WordBrand(3));
            //test.add(new WordBrand(3));
            //test.add(new WordBrand(5));
            //l.setPlayer(test);

            l.setPlayer(player[0]);

            Brand t = l.getReadyBrand();
            Console.WriteLine("==>{0}{1}", t.getNumber(), t.getClass());
            //printplayer(player);

            //sa.getReadyBrand();
            //Console.WriteLine();
            //Console.WriteLine("Ready Brand is {0},{1}", l.getReadyBrand().getClass(), l.getReadyBrand().getNumber());
        }
Exemple #4
0
        public DealTest()
        {
            BrandPlayer[] player = new BrandPlayer[4];
            BrandPlayer table = new BrandPlayer();

            BrandFactory x = new BrandFactory();
            x.createBrands();
            x.randomBrands();

            table = x.getBrands();
            Console.WriteLine("�@��: {0}",table.getCount());
            // �L�X�~�n���P
            printplayer(table,"�üƵP");

            PlayerSort bbs = new PlayerSort(table);
            BrandPlayer sort_table = bbs.getPlayer;
            printplayer(sort_table,"�üƱƧǦ^�h");

            // ���t�P
            Deal deal = new Deal(16,table);
            deal.DealBrands();
            player = deal.Player;

            // �L�X���������a
            printplayer(player);

            BrandPlayer check = new BrandPlayer();

            foreach (BrandPlayer b in player)
                for (int i = 0; i < b.getCount(); i++)
                    check.add(b.getBrand(i));
            for (int i = 0; i < table.getCount(); i++)
                check.add(table.getBrand(i));
            PlayerSort bs = new PlayerSort(check);
            check = bs.getPlayer;
            Console.WriteLine("\n�@��: {0}",check.getCount());
            printplayer(check,"���s�ˬd");
        }
Exemple #5
0
 /// <summary>
 /// ������U�Ӫ��a�ҭn�����Ʊ�
 /// </summary>
 /// <param name="sender">�ɶ��˼ƾ�</param>
 /// <param name="e"></param>
 protected void rotateTimer_Tick(object sender, EventArgs e)
 {
     try
     {
         round();
     }
     catch (FlowOverException)
     {
         // �y��
         MessageBox.Show(Settings.Default.FlowEnd);
         table.cleanImage();
         factory = new BrandFactory();
         all.nextWiner(true);
         // �s��
         newgame_round();
     }
     catch (ErrorBrandPlayerCountException)
     {
         MessageBox.Show(Settings.Default.ErrorBrandPlayer);
     }
 }
Exemple #6
0
 /// <summary>
 /// ����C��
 /// </summary>
 internal void win_game(Brand brand)
 {
     //�M���ୱ�W���P
     table.cleanImage();
     //����j��
     roundTimer.Stop();
     //��̫ᨺ�i�P�[�J���a��P
     all.NowPlayer.add(brand);
     //�]�w�P���i���ç�s
     table.ShowAll = true;
     table.addImage();
     //�I�s�x�ƭp��
     Tally t = new Tally();
     t.setLocation(all.getLocation, all.Win_Times);
     t.setPlayer(all);
     t.ShowDialog();
     //�M���ୱ�W���P
     table.cleanImage();
     //����U�@�Ӳ�
     all.nextWiner(false);
     //�]�w�������P�������
     table.ShowAll = false;
     //�}�s���C��
     newgame_round();
     factory = new BrandFactory();
 }
Exemple #7
0
        internal override void round()
        {
            try
            {
                // �p�G�O�Y�θI���N�P
                if (Chow_Pong_Brand)
                    Chow_Pong_Brand = false;
                else
                    touchBrand();

                // �ثe���A�����󪱮a��
                if (!NowPlayer_is_Real_Player)
                    makeBrand(getfromAI());
                else
                    setInforamtion();

                // �P�B���a���
                chat.SendObject(all);
            }
            catch (FlowOverException)
            {
                // �y��
                MessageBox.Show(Settings.Default.FlowEnd);
                table.cleanImage();
                factory = new BrandFactory();
                all.nextWiner(true);
                // �إߵP
                creatBrands();
                // �s��
                newgame_round();
            }
            catch (ErrorBrandPlayerCountException)
            {
                MessageBox.Show(Settings.Default.ErrorBrandPlayer);
            }

            table.cleanImage();
            table.addImage();
        }