plamen1982

PIN

Apr 27th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. function PIN(args) {
  2. let params = args
  3.  
  4. if(args[0].indexOf('\n') > -1) {
  5. params = args[0].split('\n')
  6. }
  7.  
  8. let n = Number(params[0])
  9. let width = 6 * n + 10
  10. let columns = 2 * n + 2
  11. let space = 2 * n
  12. let space2 = 0
  13. let letterP = Math.floor(n / 2)
  14.  
  15.  
  16. console.log('/`' + 'P'.repeat(2 * n) + ' '.repeat(n) +'/`I' + ' '.repeat(n) + '/`N' + ' '.repeat(2 * n + 1) + 'N')
  17.  
  18. for(let count1 = 0; count1 < n - 1; count1++) {
  19. console.log('| P' + ' '.repeat(2 * n - 2) + 'P' + ' '.repeat(n) + '| I' + ' '.repeat(n) + '| ' + 'N' + ' '.repeat(space2) + 'N' + ' '.repeat(space) + 'N')
  20. space--
  21. space2++
  22. }
  23.  
  24. console.log('| ' + 'P'.repeat(2 * n) + ' '.repeat(n) + '| I' + ' '.repeat(n) + '| N' + ' '.repeat(space2) + 'N' + ' '.repeat(space) + 'N')
  25.  
  26. let spacesAfterDoubleP = width - 2 * 3 - 2 * 2 - letterP - n
  27.  
  28. for(let count2 = 0; count2 < n; count2++) {
  29. space--
  30. space2++
  31. console.log('| ' + 'P'.repeat(letterP) + ' '.repeat(spacesAfterDoubleP - space2 - space) + '| I' + ' '.repeat(n) + '| N' + ' '.repeat(space2) + 'N' + ' '.repeat(space) + 'N')
  32. }
  33. space--
  34. space2++
  35. console.log('\\_' + 'P'.repeat(letterP) + ' '.repeat(spacesAfterDoubleP - space2 - space) + '\\_I' + ' '.repeat(n) + '\\_N' + ' '.repeat(space2) + 'NN')
  36.  
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment