-
-
Save hetoro/dce3cc0ab8544edeffeb947fb231340e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rows = 5 | |
const symbol = "*" | |
const frame = " " | |
const space = " " | |
const hat = "-" | |
/* | |
- | |
--- | |
----- | |
------- | |
--------- | |
*/ | |
for (let i = 1; i <= rows; i++) { | |
for (let j = 1; j <= (rows * 2) - i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
for (let j = 1; j < i * 2; j++) { | |
process.stdout.write(`${hat}`) | |
} | |
for (let j = 1; j <= (rows * 2) - i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
console.log() | |
} | |
/* | |
-----*----- | |
----*****---- | |
---*********--- | |
--*************-- | |
-*****************- | |
*/ | |
for (let i = 1; i <= rows; i++) { | |
for (let j = 1; j <= rows - i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
for (let j = rows - i; j >= 0; j--) { | |
process.stdout.write(`${hat}`) | |
} | |
for (let j = 1; j < (i * 4) - 2; j++) { | |
process.stdout.write(`${symbol}`) | |
} | |
for (let j = rows - i; j >= 0; j--) { | |
process.stdout.write(`${hat}`) | |
} | |
for (let j = 1; j <= rows - i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
console.log() | |
} | |
/* | |
************* | |
- ********* - | |
-- ***** -- | |
--- * --- | |
*/ | |
for (let i = 1; i < rows; i++) { | |
for (let j = 1; j <= i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
for (let j = 1; j <= i - 1; j++) { | |
process.stdout.write(`${hat}`) | |
} | |
process.stdout.write(` `) | |
for (let j = 1; j < (rows * 4) - (i * 4) - 2; j++) { | |
process.stdout.write(`${symbol}`) | |
} | |
process.stdout.write(` `) | |
for (let j = 1; j <= i - 1; j++) { | |
process.stdout.write(`${hat}`) | |
} | |
for (let j = 1; j <= i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
console.log() | |
} | |
/* | |
--------- | |
------- | |
----- | |
--- | |
- | |
*/ | |
for (let i = 1; i <= rows; i++) { | |
for (let j = 1; j < rows + i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
for (let j = (rows * 2) - i; j >= i; j--) { | |
process.stdout.write(`${hat}`) | |
} | |
for (let j = 1; j < rows + i; j++) { | |
process.stdout.write(`${frame}`) | |
} | |
console.log() | |
} | |
/* | |
- | |
--- | |
----- | |
------- | |
--------- | |
-----*----- | |
----*****---- | |
---*********--- | |
--*************-- | |
-*****************- | |
************* | |
- ********* - | |
-- ***** -- | |
--- * --- | |
--------- | |
------- | |
----- | |
--- | |
- | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment