diff --git a/src/makeRobot.js b/src/makeRobot.js index fc967851..007b371f 100644 --- a/src/makeRobot.js +++ b/src/makeRobot.js @@ -38,6 +38,9 @@ * @return {Robot} */ function makeRobot(name, wheels, version) { + const EVACUATE_COORDINATE_X = 1400; + const EVACUATE_COORDINATE_Y = 500; + const robot = { name, wheels, @@ -56,41 +59,41 @@ function makeRobot(name, wheels, version) { return `${this.name}: x=${this.coords.x}, y=${this.coords.y}`; }, - goForward(value = 1) { - if (value > 0) { - this.coords.y += value; + goForward(step = 1) { + if (step > 0) { + this.coords.y += step; }; return this; }, - goBack(value = 1) { - if (value > 0) { - this.coords.y -= value; + goBack(step = 1) { + if (step > 0) { + this.coords.y -= step; }; return this; }, - goRight(value = 1) { - if (value > 0) { - this.coords.x += value; + goRight(step = 1) { + if (step > 0) { + this.coords.x += step; }; return this; }, - goLeft(value = 1) { - if (value > 0) { - this.coords.x -= value; + goLeft(step = 1) { + if (step > 0) { + this.coords.x -= step; }; return this; }, evacuate() { - this.coords.x = 1400; - this.coords.y = 500; + this.coords.x = EVACUATE_COORDINATE_X; + this.coords.y = EVACUATE_COORDINATE_Y; }, };