plamen1982

sword

Apr 1st, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. function sword(args) {
  2. let n = Number(args[0])
  3. let width = (2 * n) + 1
  4. let upperPartDashes = 2;
  5. let upperPartSpaces = 2;
  6. let dashesSoftUni = ((width - 3) / 2) - Math.floor(n/2)
  7. if(n >= 4 && n <= 50) {
  8. console.log('#'.repeat(n - 1) + '/' + '^' + '\\' + '#'.repeat(n - 1))
  9. for(let i = 1; i <= Math.floor(n / 2); i++) {
  10. console.log('#'.repeat(n - upperPartDashes) + '.' + ' '.repeat(upperPartSpaces + 1) + '.' + '#'.repeat(n - upperPartDashes))
  11. upperPartDashes += 1
  12. upperPartSpaces += 2
  13. }
  14. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'S' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  15. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'O' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  16. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'F' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  17. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'T' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  18. for(let j = 1; j < Math.round(n/2); j++) {
  19. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + ' ' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  20. }
  21. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'U' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  22. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'N' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  23. console.log('#'.repeat(dashesSoftUni) + '|' +' '.repeat(Math.floor(n/2)) + 'I' + ' '.repeat(Math.floor(n/2)) + '|' + '#'.repeat(dashesSoftUni))
  24. console.log('@' + '='.repeat(width -2) + '@')
  25. for(let k = 0; k < Math.floor(n/2); k++) {
  26. if(n % 2 == 0) {
  27. let dots = width - (Math.floor(width / 3) + Math.floor(width / 3) + 2 )
  28. console.log('#'.repeat(Math.floor(width/3)) + '|' + ' '.repeat(dots) + '|' + '#'.repeat(Math.floor(width/3)))
  29.  
  30. // width/ 3
  31. } else {
  32. let dotsOdd = width - (Math.ceil(width / 3) + Math.ceil(width / 3) + 2)
  33. console.log('#'.repeat(Math.ceil(width / 3)) + '|' + ' '.repeat(dotsOdd) + '|' + '#'.repeat(Math.ceil(width/3)))
  34. //Math.ceil(width/3)
  35. }
  36. }
  37. if(n % 2 == 0) {
  38. let dots = width - (Math.floor(width / 3) + Math.floor(width / 3) + 2 )
  39. console.log('#'.repeat(Math.floor(width/3)) + '\\' + '.'.repeat(dots) + '/' + '#'.repeat(Math.floor(width/3)))
  40.  
  41. // width/ 3
  42. } else {
  43. let dotsOdd = width - (Math.ceil(width / 3) + Math.ceil(width / 3) + 2)
  44. console.log('#'.repeat(Math.ceil(width/3)) + '\\' + '.'.repeat(dotsOdd) + '/' + '#'.repeat(Math.ceil(width/3)))
  45. //Math.ceil(width/3)
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment