// Cloned by oishin on 18 Nov 2018 from Mind "Big Brain" by oishin
// Please leave this clone trail here.
function Mind()
{
this.newRun = function(World)
{
//Description: This method is called in the beginning of each simulation,
//it is the best place to set and reset the inner variables of this Mind object.
};
//const ACTION_LEFT = 0;
//const ACTION_RIGHT = 1;
//const ACTION_UP = 2;
//const ACTION_DOWN = 3;
//const ACTION_STAYSTILL = 4;
//grid blank = 0, grid wall = 1, gridmaze = 2
this.getAction = function ( state )//there would have to be if statements here depending on
{
this.pos1x = state[0];
this.pos1y = state[1];
this.pos2x = state[2];
this.pos2y = state[3];
this.compx;
this.compy;
//var object=new World();
//object.occupied(4,4);
if(this.compx == this.pos1x || this.compy == this.pos1y)
{
return Math.floor(Math.random() * 4);
}
else if(this.pos2x > 9 && this.pos2y > 9) //18,18
{
if(this.pos1x != 2)
{
this.compx = this.pos1x;
console.log(this.comp,this.pos1x);
return 0;
}
else if(this.pos1y != 2)
{
this.compy = this.pos1y;
return 3;
}
}
else if(this.pos2x > 9 && this.pos2y <= 9) //18,1
{
if(this.pos1x != 2)
{
this.compx = this.pos1x;
return 0;
}
else if(this.pos1y != 17)
{
this.compy = this.pos1y;
return 2;
}
}
else if(this.pos2x <= 9 && this.pos2y > 9) //1,18
{
if(this.pos1x != 17)
{
this.compx = this.pos1x;
return 1;
}
else if(this.pos1y != 2)
{
this.compy = this.pos1y;
return 3;
}
}
else if(this.pos2x <= 9 && this.pos2y <= 9) //1,1
{
if(this.pos1x != 17)
{
this.compx = this.pos1x;
return 1;
}
else if(this.pos1y != 17)
{
this.compy = this.pos1y;
return 2;
}
}
};
this.endRun = function()
{
//Description: This method is called in the end of each simulation.
};
}