Advertisement
Spocoman

Cat Food Meow

Jan 10th, 2022 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function catFoodMeow(input) {
  2.     let n = Number(input);
  3.  
  4.     let output = '.'.repeat(n - 1) + '|' + `${'\\/'.repeat(n)}` + `|${'.'.repeat(n - 1)}\n`
  5.         + `${'.'.repeat(n - 1)}|` + `${'~'.repeat(2 * n)}` + `|${'.'.repeat(n - 1)}\n`;
  6.  
  7.     for (let i = 1; i <= n; i++) {
  8.         output += `${'.'.repeat(n - 1)}|${' '.repeat(i - 1)}`;
  9.         for (let j = n; j >= i; j--) {
  10.             output += '{}';
  11.         }
  12.         output += `${' '.repeat(i - 1)}|${'.'.repeat(n - 1)}\n`;
  13.     }
  14.     output += `${'.'.repeat(n - 1)}|${' '.repeat(n - 2)}` + `MEOW${' '.repeat(n - 2)}|${'.'.repeat(n - 1)}\n`
  15.         + `${'.'.repeat(n - 1)}|${' '.repeat(n - 2)}` + `FOOD${' '.repeat(n - 2)}|${'.'.repeat(n - 1)}\n`;
  16.  
  17.     for (let i = 1; i <= n; i++) {
  18.         output += `${'.'.repeat(n - 1)}|${' '.repeat(n - i)}`;
  19.         for (let j = 1; j <= i; j++) {
  20.             output += '{}';
  21.         }
  22.         output += `${' '.repeat(n - i)}|${'.'.repeat(n - 1)}\n`;
  23.     }
  24.     output += `${'.'.repeat(n - 1)}|` + `${'~'.repeat(2 * n)}` + `|${'.'.repeat(n - 1)}\n`
  25.         + `${'.'.repeat(n - 1)}|` + `${'\\/'.repeat(n)}` + `|${'.'.repeat(n - 1)}`;
  26.  
  27.     console.log(output);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement