// Cloned by HaoIoCheong on 9 Nov 2021 from Mind "Complex Mind (clone by Radwan Duadu) (clone by Cian)" by Cian
// Please leave this clone trail here.
// Cloned by Cian on 8 Nov 2021 from Mind "Complex Mind (clone by Radwan Duadu)" by Radwan Duadu
// Please leave this clone trail here.
AB.mind.getAction=function(r){var a=r[0],n=r[1],e=r[2],o=r[3],t=r[4].length,A=r[4],i=new Array(t);for(f=0;f<t;f++)i[f]=new Array(t);for(var f=0;f<t;f++)for(var l=0;l<t;l++)i[f][l]=A[f][l];var v,h=0,T=new Array(4),g=i[a+1][n],w=i[a-1][n],I=i[a][n+1],N=i[a][n-1];for(T[0]=g,T[1]=w,T[2]=I,T[3]=N,f=0;f<T.length;f++){for(var O=T[f].neighbors,C=0,_=0;_<O.length;_++){O[_].wall&&C++}if(C<3&&!T[f].wall)(t=Math.abs(T[f].i-e)+Math.abs(T[f].j-o))>h&&(h=t,v=T[f])}var b=v.i,s=v.j;return s<n?ACTION_DOWN:s>n?ACTION_UP:b<a?ACTION_LEFT:b>a?ACTION_RIGHT:void 0};