Create a program that takes in commands to draw different figures.
Your program will take a command to draw a "row", (it will be a <p>
tag) with the number of columns you want to draw.
Start by outputting a πfor each column.
Example:
You input: 3
.
Your program draws:
πππ
Your HTML would look like this:
<p>πππ</p>
You input 2
.
Your program draws a new row, adding to what's already there:
πππ
ππ
You can type clear
to clear the elements out of the DOM.
When you type clear 2
it clears the 2nd row. (Note: you will need .split
to get the 2 arguments out of this input string)
Add the ability to add multiple rows at a time.
Example:
You can type 2 2
.
Your program will make a shape like this:
ππ
ππ
The HTML should look like this:
<p>ππ</p>
<p>ππ</p>
When your program first runs, ask the user what character or emoji that your program will use to draw, for all commands.
Add the ability to draw triangles.
Type triangle 3
would draw:
π
ππ
πππ
Create a reverse triangle:
Type rtriangle 3
would draw:
π
ππ
πππ
Note: you will need the HTML entity
to create spaces. See: https://www.w3schools.com/html/html_entities.asp
Create a program that draws on a 4 x 4 area.
Create a "cursor" that keeps track of where to draw from.
When you type down 2
the program draws in that direction. Start with just the commands up
, down
, left
, right
.
Given your cursor is at: 0,1
β¬c β¬β¬
β¬β¬β¬β¬
β¬β¬β¬β¬
β¬β¬β¬β¬
You type: down 2
β¬πβ¬β¬
β¬πβ¬β¬
β¬β¬β¬β¬
β¬β¬β¬β¬
Check the user's input to make sure they are not drawing out of the drawing area.
At the beggining of the program, tell the program how large the drawing field should be. Make it a single number (i.e., square)
Add the ability to make equilateral triangles and upsidedown equilateral triangles.
Type: etriangle 3
π
ππ
πππ
Type: eutriangle 3
πππ
ππ
π