Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sword(args) {
- let n = Number(args[0])
- let width = (2 * n) + 1
- let upperPartDashes = 2;
- let upperPartSpaces = 2;
- let dashesSoftUni = ((width - 3) / 2) - Math.floor(n/2)
- if(n >= 4 && n <= 50) {
- console.log('#'.repeat(n - 1) + '/' + '^' + '\\' + '#'.repeat(n - 1))
- for(let i = 1; i <= Math.floor(n / 2); i++) {
- console.log('#'.repeat(n - upperPartDashes) + '.' + ' '.repeat(upperPartSpaces + 1) + '.' + '#'.repeat(n - upperPartDashes))
- upperPartDashes += 1
- upperPartSpaces += 2
- }
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'S' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'O' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'F' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'T' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- for(let j = 1; j < Math.round(n/2); j++) {
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + ' ' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- }
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'U' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'N' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'I' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
- console.log('@' + '='.repeat(width -2) + '@')
- for(let k = 0; k < Math.floor(n/2); k++) {
- if(n % 2 == 0) {
- let dots = width - (Math.floor(width / 3) + Math.floor(width / 3) + 2 )
- console.log('#'.repeat(Math.floor(width/3)) + '|' + ' '.repeat(dots) + '|' + '#'.repeat(Math.floor(width/3)))
- // width/ 3
- } else {
- let dotsOdd = width - (Math.ceil(width / 3) + Math.ceil(width / 3) + 2)
- console.log('#'.repeat(Math.ceil(width / 3)) + '|' + ' '.repeat(dotsOdd) + '|' + '#'.repeat(Math.ceil(width/3)))
- //Math.ceil(width/3)
- }
- }
- if(n % 2 == 0) {
- let dots = width - (Math.floor(width / 3) + Math.floor(width / 3) + 2 )
- console.log('#'.repeat(Math.floor(width/3)) + '\\' + '.'.repeat(dots) + '/' + '#'.repeat(Math.floor(width/3)))
- // width/ 3
- } else {
- let dotsOdd = width - (Math.ceil(width / 3) + Math.ceil(width / 3) + 2)
- console.log('#'.repeat(Math.ceil(width/3)) + '\\' + '.'.repeat(dotsOdd) + '/' + '#'.repeat(Math.ceil(width/3)))
- //Math.ceil(width/3)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment