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