distance routine improved a little; still not safe!
This commit is contained in:
parent
d49fb42d47
commit
c146e278fc
|
@ -282,6 +282,7 @@ distance(cindex) {
|
||||||
int tokexp,tpl;
|
int tokexp,tpl;
|
||||||
int expsize,toksize,exact;
|
int expsize,toksize,exact;
|
||||||
int xsekt=0;
|
int xsekt=0;
|
||||||
|
int fromstackneeded=0;
|
||||||
|
|
||||||
bp = &coderules[cindex];
|
bp = &coderules[cindex];
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -305,6 +306,7 @@ distance(cindex) {
|
||||||
if (stackheight < tpl) {
|
if (stackheight < tpl) {
|
||||||
if (xsekt)
|
if (xsekt)
|
||||||
return(MAXINT);
|
return(MAXINT);
|
||||||
|
fromstackneeded = tpl - stackheight;
|
||||||
tpl = stackheight;
|
tpl = stackheight;
|
||||||
} else
|
} else
|
||||||
if (stackheight != tpl && xsekt==2)
|
if (stackheight != tpl && xsekt==2)
|
||||||
|
@ -325,12 +327,12 @@ distance(cindex) {
|
||||||
} else
|
} else
|
||||||
exact++;
|
exact++;
|
||||||
}
|
}
|
||||||
if (exact==tpl) {
|
if (exact==tpl && ! fromstackneeded) {
|
||||||
if (xsekt)
|
if (xsekt)
|
||||||
return(0);
|
return(0);
|
||||||
return(10-exact);
|
return(10-exact);
|
||||||
}
|
}
|
||||||
return(20-exact);
|
return(20-exact+fromstackneeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned costcalc(cost) cost_t cost; {
|
unsigned costcalc(cost) cost_t cost; {
|
||||||
|
|
Loading…
Reference in a new issue