diff --git a/script.js b/script.js index 0f68729..a3fa3b4 100644 --- a/script.js +++ b/script.js @@ -1,6 +1,39 @@ // Please declare functions and variables above where they are used. +var currentGamemode = 'User input shape'; +var shapeChose = ''; var main = function (input) { - var myOutputValue = 'hello world'; + var myOutputValue = ''; + if (currentGamemode == 'User input shape') { + shapeChose = input; + currentGamemode = 'input dimensions'; + } else if (currentGamemode == 'input dimensions') { + if (shapeChose == 'square') { + // draw square + var counter = 0; + while (counter < input) { + var innerCounter = 0; + while (innerCounter < input) { + myOutputValue += '😀'; + innerCounter += 1; + } + counter += 1; + myOutputValue += '
'; + } + } else if (shapeChose == 'triangle') { + // draw triangle + var counter = 0; + while (counter < input) { + var innerCounter = 0; + while (innerCounter <= counter) { + myOutputValue += '😀'; + innerCounter += 1; + } + counter += 1; + myOutputValue += '
'; + } + } + } + // returning output return myOutputValue; };