示例#1
0
 public OutputConverter(ESquarMatrix ess, List <String> lis_str)
 {
     es = ess;
     foreach (var s in lis_str)
     {
         int pom = Int32.Parse(s);
         list.Add(pom);
     }
 }
示例#2
0
文件: 3x3.cs 项目: MichalG10/E-squaro
        public ESquarMatrix Fill(ESquarMatrix es, CellType[,] ct)
        {
            int i = 0, j = 0, z = 0;

            try
            {
                for (i = 0; i < 9; i++)
                {
                    for (j = 0; j < 9; j++)
                    {
                        if (z == 12)
                        {
                            es.AddCell(ct[0, 0], i, j);
                        }
                        else if (z == 20)
                        {
                            es.AddCell(ct[0, 1], i, j);
                        }
                        else if (z == 22)
                        {
                            es.AddCell(ct[0, 2], i, j);
                        }
                        else if (z == 26)
                        {
                            es.AddCell(ct[1, 0], i, j);
                        }
                        else if (z == 28)
                        {
                            es.AddCell(ct[1, 1], i, j);
                        }
                        else if (z == 30)
                        {
                            es.AddCell(ct[1, 2], i, j);
                        }
                        else if (z == 34)
                        {
                            es.AddCell(ct[2, 0], i, j);
                        }
                        else if (z == 36)
                        {
                            es.AddCell(ct[2, 1], i, j);
                        }
                        else if (z == 42)
                        {
                            es.AddCell(ct[2, 2], i, j);
                        }
                        else
                        {
                            es.AddCell(list[z], i, j);
                        }
                    }
                    j = 0;
                }
            }
            catch (Exception ex) { }
            return(es);
        }
示例#3
0
        //------------------------------------------------------------------------------------------------------------------------------------------
        //-------------------------------------------------------------Przycisk Działania-----------------------------------------------------------
        //------------------------------------------------------------------------------------------------------------------------------------------

        private void button14_Click(object sender, EventArgs e)
        {
            if (stworzono_tablice)
            {
                do_esqaro();
                E_squaro.CellType[][] Tablica_CellType = Zwroc_Tablice_CellType(szerokosc_esqaro);
                ESquarMatrix          ESM         = new ESquarMatrix(szerokosc_esqaro, szerokosc_esqaro);
                RSatBuilder           rsatBuilder = new RSatBuilder();
                for (int i = 0; i < szerokosc_esqaro; i++)
                {
                    for (int j = 0; j < szerokosc_esqaro; j++)
                    {
                        ESM.AddCell(Tablica_CellType[i][j], i, j);
                    }
                }

                rsatBuilder.GenerateInput(ESM.GetCellsList());

                rsatBuilder.RunRSatSolver();

                var wynik = rsatBuilder.GetInterpretedOutput();

                if (wynik != null)
                {
                    rsatBuilder.SaveOutput();

                    OutputConverter OC = new OutputConverter(ESM, wynik);

                    Z_Listy_Bool(OC.Convert());

                    Z_esqaro();
                }
                else
                {
                    MessageBox.Show("Problem jest nierozwiązywalny");
                }
            }
            rysuj_matryce();
        }
示例#4
0
文件: 3x3.cs 项目: MichalG10/E-squaro
        public _3x3(CellType[,] ct)
        {
            ESquarMatrix esm = new ESquarMatrix(9, 9);

            this.Fill(esm, ct);
        }