// Cloned by Liamooc on 5 Nov 2018 from Mind "New Mind(copypasta)" by Liamooc // Please leave this clone trail here.// Cloned by Liamooc on 25 Oct 2018 from Mind "Complex Mind" by Starter user // Please leave this clone trail here.// ==== Starter Mind ===============================================================================================// (c) Ancient Brain Ltd. All rights reserved.// This code is only for use on the Ancient Brain site.// This code may be freely copied and edited by anyone on the Ancient Brain site.// This code may not be copied, re-published or used on any other website.// To include a run of this code on another website, see the "Embed code" links provided on the Ancient Brain site.// ==================================================================================================================// =================================================================================================// Sample Mind for more complex starter World // =================================================================================================// World tells us agent position and enemy position// World does not tell us of existence of walls// if return invalid move (not empty square) World just ignores it and we miss a turn //import "Cloned CA318 2018 world";functionMind(){this.newRun =function(){const texturefile ="/uploads/ocearbl2/raf750x1000075tfafafa_ca443f4786.u2.jpg";var loader =new THREE.TextureLoader();
loader.load (texturefile,function( thetexture){
thetexture.minFilter = THREE.LinearFilter;
theobject.material =new THREE.MeshBasicMaterial({ map: thetexture });});};//return(AB.randomIntAtoB(0,300635))// };this.getAction =function( x ){var ai = x[0];var aj = x[1];var ei = x[2];var ej = x[3];// if strictly move away, will get stuck at wall, so introduce randomness //if ( occupied (ai-1,aj) && occupied (ai+1,aj) && occupied ( ai,aj+1) // ) return (ACTION_DOWN); //if ( occupied (ai-1,aj) && occupied (ai+1,aj) &&occupied ( ai,aj-1)// ) return (ACTION_UP);//if ( occupied (ai-1,aj) && occupied ( ai,aj+1) &&occupied ( ai,aj-1)// ) return (ACTION_RIGHT);//if ( occupied (ai+1,aj) && occupied ( ai,aj+1) &&occupied ( ai,aj-1)// ) return (ACTION_LEFT);//while (occupied(ai-1,j-1));{ return (AB.randomPick (ACTION_UP, ACTION_RIGHT));}//if (occupied(ai+1,j-1)) return (ACTION_DOWN);//if (occupied(ai-1,j )) return(ACTION_RIGHT);//---ACTION_DOWN = UP//---ACTION_UP = DOWN//---ACTION_LEFT = Left//---ACTION_RIGHT = Right// while(ei < (10) ){// if (aj-1 == GRID_WALL){// return ( AB.randomPick ( ACTION_RIGHT, AB.randomPick( ACTION_DOWN, ACTION_RIGHT)))}// if (aj+1 == GRID_WALL){// return ( AB.randomPick ( ACTION_RIGHT, AB.randomPick( ACTION_UP, ACTION_RIGHT )))}// }// while(ei > (10)){// if (aj-1 == GRID_WALL){// return ( AB.randomPick ( ACTION_LEFT, AB.randomPick( ACTION_DOWN, ACTION_RIGHT)))}// if (aj+1 == GRID_WALL){// return ( AB.randomPick ( ACTION_LEFT, AB.randomPick( ACTION_UP, ACTION_RIGHT )))}// }// i = 0;// if(i != 1000){// max = 50;// min = 1;// ai = (Math.random() * ((max - min) + 1)) + min;// aj = (Math.random() * ((max - min) + 1)) + min;// }if(aj+1==GRID_WALL){while(aj-1!= GRID_WALL){return(ACTION_UP,AB.randomPick(ACTION_UP, AB.randomPick(ACTION_LEFT,ACTION_RIGHT)))}}if(aj-1==GRID_WALL){while(aj+1!= GRID_WALL){return(ACTION_DOWN,AB.randomPick(ACTION_DOWN, AB.randomPick(ACTION_LEFT,ACTION_RIGHT)))}}if(ai+1==GRID_WALL){while(ai-1!= GRID_WALL){return(ACTION_LEFT,AB.randomPick(ACTION_LEFT, AB.randomPick(ACTION_UP,ACTION_DOWN)))}}if(ai-1==GRID_WALL){while(ai+1!= GRID_WALL){return(ACTION_RIGHT,AB.randomPick(ACTION_RIGHT, AB.randomPick(ACTION_UP,ACTION_DOWN)))}}while( ej < aj )return( AB.randomPick ( ACTION_UP, AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));while( ej > aj )return( AB.randomPick ( ACTION_DOWN, AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));while( ei < ai )return( AB.randomPick ( ACTION_LEFT, AB.randomPick(ACTION_UP,ACTION_DOWN)));while( ei > ai )return( AB.randomPick ( ACTION_RIGHT, AB.randomPick(ACTION_UP,ACTION_DOWN)));if( ej < aj )return( AB.randomPick ( ACTION_UP, AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));if( ej > aj )return( AB.randomPick ( ACTION_DOWN, AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));if( ei < ai )return( AB.randomPick ( ACTION_RIGHT, AB.randomPick(ACTION_UP,ACTION_DOWN)));if( ei > ai )return( AB.randomPick ( ACTION_LEFT, AB.randomPick(ACTION_UP,ACTION_DOWN)));//if ((ej < aj) + (ei < ai)) return ((AB.randomPick (ACTION_RIGHT, ACTION_UP) ));//if ((ej > aj) + (ei > ai)) return ((AB.randomPick (ACTION_LEFT, ACTION_DOWN) ));//if ((ej < aj) + (ei > ai)) return ((AB.randomPick (ACTION_RIGHT, ACTION_DOWN) ));//if ((ej > aj) + (ei < ai)) return ((AB.randomPick (ACTION_LEFT, ACTION_UP) ));//if ( stuckfor > 2 ) return ( i = AB.randomIntAtoB(1,gridsize-2), j = AB.randomIntAtoB(1,gridsize-2), drawAgent());// }return( AB.randomIntAtoB (0,3));}}//this.endRun = function() //{//};