function Mind() { this.newRun = function() { }; this.getAction = function (arr) // x is an array of [x1, y1, x2, y2] { var x = arr[0]; var y = arr[1]; var x2 = arr[2]; var y2 = arr[3]; var distance = (x2 - x) + (y2 - y) console.log(distance) return AB.randomIntAtoB(0,4); }; this.endRun = function() { }; }