diff --git a/assets/css/style.css b/assets/css/style.css index 740b9a3..aedca28 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1,5 +1,5 @@ body { - background-color: navy; + background-color: rgb(171, 171, 218); color: white; } diff --git a/assets/js/footer-functions.js b/assets/js/footer-functions.js index 42cc05b..af69436 100644 --- a/assets/js/footer-functions.js +++ b/assets/js/footer-functions.js @@ -22,9 +22,9 @@ function getBoxTests() { } function getBottomLeftTriangleTests() { - testGetBottomLeftTriangle("*", 1); - testGetBottomLeftTriangle("*\n**", 2); - testGetBottomLeftTriangle("*\n**\n**", 3); + testGetBottomLeftTriangle("*\n", 1); + testGetBottomLeftTriangle("*\n**\n", 2); + testGetBottomLeftTriangle("*\n**\n***\n", 3); } function getUpperLeftTriangleTests() { diff --git a/assets/js/shapes.js b/assets/js/shapes.js index e4351ba..d9fe7d9 100644 --- a/assets/js/shapes.js +++ b/assets/js/shapes.js @@ -1,31 +1,73 @@ function getLine(length) { - // TODO - write method definition here -} + let lineExpected= ""; + for(let loopCounter = 0; loopCounter < length; loopCounter++){ + lineExpected = lineExpected + "*"; + } + return lineExpected; +} function getBox(width, height) { - // TODO - write method definition here + let lineExpected= ""; + for(let lineLoopCounter = 0; lineLoopCounter < width; lineLoopCounter++){ + for(let culLoopCounter = 0; culLoopCounter < height; culLoopCounter++){ + lineExpected = lineExpected + "*"; + } + lineExpected = lineExpected + "\n"; + } + return lineExpected; } - - function getBottomLeftTriangle(length) { - // TODO - write method definition here + let lineExpected= ""; + for(let lineLoopCounter = 0; lineLoopCounter <= length; lineLoopCounter++){ + for(let culLoopCounter = 0; culLoopCounter < lineLoopCounter; culLoopCounter++){ + lineExpected = lineExpected + "*"; + } + lineExpected = lineExpected + "\n"; + } + return lineExpected; } - function getUpperLeftTriangle(length) { - // TODO - write method definition here + let lineExpected= ""; + for(let lineLoopCounter = length; lineLoopCounter >= 0; lineLoopCounter--){ + for(let culLoopCounter = lineLoopCounter ; culLoopCounter > 0; culLoopCounter--){ + lineExpected = lineExpected + "*"; + } + lineExpected = lineExpected + "\n"; + } + return lineExpected; } - - function getPyramid(length) { - // TODO - write method definition here + let lineExpected= ""; + for(let lineLoopCounter = 0; lineLoopCounter <= length; lineLoopCounter++){ + if (lineLoopCounter %2 != 0){ + for(let culLoopCounter = 0; culLoopCounter < lineLoopCounter; culLoopCounter++){ + lineExpected = lineExpected + "*"; + } + } + lineExpected = lineExpected + "\n"; + } + return lineExpected; } function getCheckerboard(width, height) { - // TODO - write method definition here -} + let lineExpected= "_"; + for(let lineLoopCounter = 0; lineLoopCounter < width; lineLoopCounter++){ + for(let culLoopCounter = 0; culLoopCounter < height; culLoopCounter++){ + i = lineExpected.charAt(myString.length - 1) + if (i == "\n") + lineExpected.charAt(myString.length - 2) + if(i == "*") + lineExpected = lineExpected + "_"; + else + lineExpected = lineExpected + "*"; + } + lineExpected = lineExpected + "\n"; + } + return lineExpected; +} \ No newline at end of file