3 ms·
Got it down to 118 bytes ;) function tm(I,t,e,s,i,c,k){for(i=0;s!=e;i+=k.m,s=k.n){k=I[s][(c=t[i])||"B"];if(!k)return k;t.splice(i,1,k.w)}return t} You cou
by friggeri 15y ago
Got it down to 118 bytes ;)
function tm(I,t,e,s,i,c,k){for(i=0;s!=e;i+=k.m,s=k.n){k=I[s][(c=t[i])||"B"];if(!k)return k;t.splice(i,1,k.w)}return t}
You could actually save one more byte by changing the name of the function, but that would be cheating, right ? ;-)
Edit, Refined it to get to 110:
function tm(I,t,e,s,i,c,k){for(i=0;s!=e;t[i]=k.w,i+=k.m,s=k.n){k=I[s][(c=t[i])||"B"];if(!k)return k;}return t}