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); }
//------------------------------------------------------------------------------------------------------------------------------------------ //-------------------------------------------------------------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(); }