form2.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace _hlavolam { public partial class Form2 : Form { public State start; public State end; public string errormsg; public Form2() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { int mm; int nn; bool generuj = false; if (int.TryParse(textBox1.Text, out mm)) { if (int.TryParse(textBox2.Text, out nn)) { //nove stavy start = new State(mm, nn); end = new State(mm, nn); //zistime, ci boly zadane pociatocne hodnoty, ak nie, ideme ich generovat if (string.IsNullOrEmpty(textBox3.Text)) generuj = true; //ak hej, spracujeme else { if (!start.parse(textBox3.Text, "Pociatocny")) { return; } } if (!end.parse(textBox4.Text, "Ziadany")) { return; } this.Close(); } } label5.Text = "Nespravne rozmery!"; return; } } } stav.cs using System; using System.Collections.Generic; using System.Text; using System.IO; namespace _hlavolam { public class State { //rozmery public int m;//riadku public int n;//stlpce //rozmiestnenie prvkov v stave public int[][] stav; //poloha prazdneho policka public int empty_x; public int empty_y; public bool empty = false; public State(int mm, int nn) { m = mm; n = nn; stav = new int[mm][]; for (int i = 0; i < mm; i++) { stav[i] = new int[nn]; } } public bool MakeView(string file) {//vytvori html prezentaciu stavu string htmlfile = "
| " + stav[i][j].ToString() +" | "; } htmlfile += "