All pastes #405266 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-21 17:08 UTC
rendered paste body
public string parse(string text, string stav)
    {
        //kolko riadkov bolo v pociatocnych hodnotach
        int tmp;
        string[] riadky = text.Split(new char[] { '\n' });
        string[] riadok;

        //zhoduje sa pocet riadkov zadany v rozmeroch s poctom riadkov s poctom riadkov v pociatocnych hodnotach?
        if (riadky.Length != this.m)
        {
            //Form2.label5.Text=string.Format("Nespravny pocet riadkov ({0} stav)!",stav);
            return "kokot";
        }

        //naplnenie pola zaciatocnych hodnot zo zadanych hodnot
        for (int i = 0; i < this.m; i++)
        {

            riadok = riadky[i].Split(new char[] { ' ' });
            if (riadok.Length != this.n)
            {
                //Form2.label5.Text = string.Format("Nespravny pocet hodnot v riadku ({0} stav)!", stav);
                return "aj tu";
            }

            for (int j = 0; j < this.n; j++)
            {
                if (int.TryParse(riadok[j], out tmp))
                {
                    this.stav[i][j] = tmp;
                }
                else
                {
                    if (this.empty)
                    {
                        //Form2.label5.Text = string.Format("Viac prazdnych poli! ({0} stav)!", stav);
                        return false;
                    }

                    if (string.Equals("x", riadok[j]))
                    {
                        this.stav[i][j] = 0;
                        this.empty = true;
                        this.empty_x = i;
                        this.empty_y = j;

                    }
                }
            }
        }

        if (!this.empty)
        {
            //Form2.label5.Text = string.Format("Nezadali ste polohu prazdneho pola! ({0} stav)!", stav);
            return "tiez nieco";
        }
        return "";
    }