diff --git a/parser.js b/parser.js index 811130d..3de7525 100644 --- a/parser.js +++ b/parser.js @@ -19,6 +19,7 @@ class Parser { /** * Private method * + * @private * @returns Boolean If the index has surpased the length of the text or not. * @memberof Parser */ @@ -29,6 +30,7 @@ class Parser { /** * Private method * + * @private * @returns String The next token after the actual index. * @memberof Parser */ @@ -85,6 +87,7 @@ class Parser { /** * Public method * + * @public * @returns [CommandExecutor] Parsed text converted into CommandExecutors * ready to be executed. * @memberof Parser diff --git a/turtle.js b/turtle.js index dfbc84a..b90c5a0 100644 --- a/turtle.js +++ b/turtle.js @@ -1,4 +1,12 @@ class Turtle { + + /** + * Creates an instance of the Turtle. + * @param {Number} x The home x location. + * @param {Number} y The home y location. + * @param {Number} angle The angle the turtle starts with + * @memberof Turtle + */ constructor(x, y, angle) { this.x = x; this.y = y; @@ -11,11 +19,15 @@ class Turtle { this.strokeColor = 255; this.strokeWeight = 1; } - + reset() { this.pen = true; } + /** + * Move the turtle forward. + * @param {Number} amt The amount the turtle needs to move forwards + */ forward(amt) { // Move the turtle this.x += cos(this.dir) * amt; @@ -32,11 +44,18 @@ class Turtle { this.prevX = this.x; this.prevY = this.y; } - + + /** + * Rotate the turtle. + * @param {Number} angle The amount the turtle needs to rotate + */ right(angle) { this.dir += angle; } + /** + * Sets the location back to the default. + */ home() { this.x = this.homeX; this.y = this.homeY;