示例#1
0
        private void CreateBoard(int nr, RozkladKart rozklad)
        {
            Section section = document.LastSection;

            Table table = new Table();

            table.Borders.Width = 0;

            Column column1 = table.AddColumn(Unit.FromCentimeter(rozklad_szerokosckolumny));
            Column column2 = table.AddColumn(Unit.FromCentimeter(rozklad_szerokosckolumny));
            Column column3 = table.AddColumn(Unit.FromCentimeter(rozklad_szerokosckolumny));

            table.Format.Alignment = ParagraphAlignment.Justify;

            /////////////////////////////////N//////////////////////////////
            Row       row = table.AddRow();
            Paragraph p   = row.Cells[1].AddParagraph();

            zrob_rozklad(rozklad.N, p);
            p.AddLineBreak();

            /////////////////////////////////W//////////////////////////////

            Row row2 = table.AddRow();

            p = row2[0].AddParagraph();
            // zrob_rozklad(rozklad.W, p);

            /////////////////////////////////E//////////////////////////////
            p = row2[2].AddParagraph();
            //  zrob_rozklad(rozklad.E, p);


            /////////////////////////////////////S//////////////////////////////////////////////
            Row row3 = table.AddRow();

            p = row3[1].AddParagraph();
            zrob_rozklad(rozklad.S, p);

            Cell cell = new Cell();

            cell = row2.Cells[1];
            cell.Borders.Width = borders_szerkoscramyrozdania;
            cell.Shading.Color = kolor_ramyrozdania;

            cell = zrob_ramke(cell, (nr + 1));



            table.SetEdge(0, 0, 3, 1, Edge.Box, BorderStyle.None, 0.0, Colors.White);
            document.LastSection.Add(table);
        }
示例#2
0
        private RozkladKart ReadBoard(int nr)
        {
            RozkladKart rozklad_    = new RozkladKart();
            string      piki        = "AKQJT98765432";
            string      kiery       = "AKQJT98765432";
            string      kara        = "AKQJT98765432";
            string      trefle      = "AKQJT98765432";
            bool        cztery_rece = false;

            //reka N
            string tmp = boardstring[nr].Split(',')[0];

            rozklad_.S      = new Karty();
            rozklad_.S.piki = "";
            int j = 2;


            while ((tmp[j].ToString() != "H"))
            {
                rozklad_.S.piki += tmp[j].ToString();
                piki             = piki.Remove(piki.LastIndexOf(tmp[j]), 1);
                j++;
            }
            j++;
            while ((tmp[j].ToString() != "D"))
            {
                rozklad_.S.kiery += tmp[j].ToString();
                kiery             = kiery.Remove(kiery.LastIndexOf(tmp[j]), 1);
                j++;
            }
            j++;
            while (tmp[j].ToString() != "C")
            {
                rozklad_.S.kara += tmp[j].ToString();
                kara             = kara.Remove(kara.LastIndexOf(tmp[j]), 1);
                j++;
            }
            j++;
            while (j < tmp.Count())
            {
                rozklad_.S.trefle += tmp[j].ToString();
                trefle             = trefle.Remove(trefle.LastIndexOf(tmp[j]), 1);
                j++;
            }


            // druga reka

            tmp = boardstring[nr].Split(',')[1];
            j   = 1;
            if (tmp != "")
            {
                rozklad_.W  = new Karty();
                cztery_rece = true;
                while ((tmp[j].ToString() != "H"))
                {
                    rozklad_.W.piki += tmp[j].ToString();
                    piki             = piki.Remove(piki.LastIndexOf(tmp[j]), 1);
                    j++;
                }
                j++;
                while ((tmp[j].ToString() != "D"))
                {
                    rozklad_.W.kiery += tmp[j].ToString();
                    kiery             = kiery.Remove(kiery.LastIndexOf(tmp[j]), 1);
                    j++;
                }
                j++;
                while (tmp[j].ToString() != "C")
                {
                    rozklad_.W.kara += tmp[j].ToString();
                    kara             = kara.Remove(kara.LastIndexOf(tmp[j]), 1);
                    j++;
                }
                j++;
                while (j < tmp.Count())
                {
                    rozklad_.W.trefle += tmp[j].ToString();
                    trefle             = trefle.Remove(trefle.LastIndexOf(tmp[j]), 1);
                    j++;
                }
            }
            // trzecia reka

            tmp = boardstring[nr].Split(',')[2];
            j   = 1;

            rozklad_.N = new Karty();

            while ((tmp[j].ToString() != "H"))
            {
                rozklad_.N.piki += tmp[j].ToString();
                piki             = piki.Remove(piki.LastIndexOf(tmp[j]), 1);
                j++;
            }
            j++;
            while ((tmp[j].ToString() != "D"))
            {
                rozklad_.N.kiery += tmp[j].ToString();
                kiery             = kiery.Remove(kiery.LastIndexOf(tmp[j]), 1);
                j++;
            }
            j++;
            while (tmp[j].ToString() != "C")
            {
                rozklad_.N.kara += tmp[j].ToString();
                kara             = kara.Remove(kara.LastIndexOf(tmp[j]), 1);
                j++;
            }
            j++;
            while (j < tmp.Count())
            {
                rozklad_.N.trefle += tmp[j].ToString();
                trefle             = trefle.Remove(trefle.LastIndexOf(tmp[j]), 1);
                j++;
            }
            if (cztery_rece)
            {
                rozklad_.E        = new Karty();
                rozklad_.E.piki   = piki;
                rozklad_.E.kiery  = kiery;
                rozklad_.E.kara   = kara;
                rozklad_.E.trefle = trefle;
            }

            return(rozklad_);
        }
示例#3
0
        public static int[,,] wylicz_DF(RozkladKart[] rozklad_kart)
        {
            int[,,] lewy = new int[Ustawienia.ilosc_rozdan + 2, 4, 5];

            Console.WriteLine("witamy");
            string YourApplicationPath = "C:\\Users\\Maciek\\Desktop";
            //   string argument = "bcalconsole -c \"T74.73.KQ87.7654 QJ53.AKT542..KQ3 8.Q96.AJT32.AJ92\"";


            ProcessStartInfo processInfo = new ProcessStartInfo();

            processInfo.WindowStyle            = ProcessWindowStyle.Normal;
            processInfo.WorkingDirectory       = Path.GetDirectoryName(MainWindow.dir);
            processInfo.FileName               = "cmd.exe";
            processInfo.UseShellExecute        = false;
            processInfo.RedirectStandardInput  = true;
            processInfo.RedirectStandardOutput = true;

            Process proc = new Process();

            proc.StartInfo = processInfo;
            proc.Start();
            proc.StandardInput.WriteLine("cd " + MainWindow.dir);

            for (int nr_rozdania = 0; nr_rozdania < Ustawienia.ilosc_rozdan; nr_rozdania++)
            {
                RozkladKart karty = rozklad_kart[nr_rozdania];
                string      elem  = "\"" + karty.N.piki + "." + karty.N.kiery + "." + karty.N.kara + "." + karty.N.trefle + " ";
                elem += karty.E.piki + "." + karty.E.kiery + "." + karty.E.kara + "." + karty.E.trefle + " ";
                elem += karty.S.piki + "." + karty.S.kiery + "." + karty.S.kara + "." + karty.S.trefle + " ";
                elem += "\"";



                string argument = "bcalconsole -e e -q -c " + elem;
                proc.StandardInput.WriteLine(argument);
                proc.StandardInput.WriteLine("A");

                StreamReader reader = proc.StandardOutput;
                string       tekst;
                if (nr_rozdania == 0)
                {
                    for (int i = 0; i < 7;)
                    {
                        tekst = reader.ReadLine();
                        i++;
                    }
                }
                else
                {
                    for (int i = 0; i < 3;)
                    {
                        tekst = reader.ReadLine();
                        i++;
                    }
                }

                for (int i = 0; i < 4; i++)
                {
                    tekst = reader.ReadLine();
                    string[] tab = tekst.Split(' ');

                    int   wyj;
                    int[] lew = new int[5];
                    int   idx = 0;
                    for (int z = 0; z < tab.Count(); z++)
                    {
                        bool result = int.TryParse(tab[z], out wyj);

                        if (result)
                        {
                            lewy[nr_rozdania, i, idx++] = int.Parse(tab[z].ToString());
                        }
                    }
                }
            }
            return(lewy);
        }