Пример #1
0
        public int calcDist(state x)
        {
            if (x == new state())
            {
                return(1337);
            }
            int d = 0;

            for (int lc = 0; lc < 3; lc++)
            {
                for (int cc = 0; cc < 3; cc++)
                {
                    for (int lf = 0; lf < 3; lf++)
                    {
                        for (int fc = 0; fc < 3; fc++)
                        {
                            if (x.reta()[lc, cc] == fin.reta()[lf, fc])
                            {
                                d = d + Math.Abs(lc - lf) + Math.Abs(cc - fc);
                            }
                        }
                    }
                }
            }
            return(d);
        }
Пример #2
0
        public int calcDiff(state x)
        {
            if (x == new state())
            {
                return(1337);
            }
            int d = 0;

            for (int l = 0; l < 3; l++)
            {
                for (int c = 0; c < 3; c++)
                {
                    if (x.reta()[l, c] != fin.reta()[l, c])
                    {
                        d++;
                    }
                }
            }
            return(d);
        }
Пример #3
0
 public int calcDist(state x)
 {
     if (x == new state())
         return 1337;
     int d = 0;
     for (int lc = 0; lc < 3; lc++)
         for (int cc = 0; cc < 3; cc++)
             for (int lf = 0; lf < 3; lf++)
                 for (int fc = 0; fc < 3; fc++)
                     if (x.reta()[lc, cc] == fin.reta()[lf, fc])
                         d =d+ Math.Abs(lc-lf)+Math.Abs(cc-fc);
     return d;
 }
Пример #4
0
 public int calcDiff(state x)
 {
     if (x == new state())
         return 1337;
     int d = 0;
     for (int l = 0; l < 3; l++)
         for (int c = 0; c < 3; c++)
             if (x.reta()[l, c] != fin.reta()[l, c])
                 d++;
     return d;
 }