bacco

Rocket

Mar 19th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function number(inputData){
  2.     var n  =  Number(inputData[0]);
  3.     var width = 3 * n;
  4.     var a = 0;
  5.     var b = 0;
  6.  
  7.     for(var i = 0; i < n; i++) {
  8.          a = (width - 2) / 2 - i;
  9.          b = (width - 2) - a * 2;
  10.         console.log(`${".".repeat(a)}/${" ".repeat(b)}\\${".".repeat(a)}`);
  11.     }
  12.  
  13.     console.log(`${".".repeat(a)}*${"*".repeat(b)}*${".".repeat(a)}`);
  14.  
  15.     for(var i = 0; i < n * 2; i++) {
  16.         console.log(`${".".repeat(a)}|${"\\".repeat(b)}|${".".repeat(a)}`);
  17.     }
  18.     a = a +1;
  19.     for(var i = 0; i < n / 2; i++) {
  20.           a-- ;
  21.           b = (width - 2) - a * 2;
  22.         console.log(`${".".repeat(a)}/${"*".repeat(b)}\\${".".repeat(a)}`);
  23.     }
  24. }
  25. // number(["6"])
  26. //                    ......../\........
  27. //                    ......./  \.......
  28. //                    ....../    \......
  29. //                    ...../      \.....
  30. //                    ..../        \....
  31. //                    .../          \...
  32. //                    ...************...
  33. //                    ...|\\\\\\\\\\|...
  34. //                    ...|\\\\\\\\\\|...
  35. //                    ...|\\\\\\\\\\|...
  36. //                    ...|\\\\\\\\\\|...
  37. //                    ...|\\\\\\\\\\|...
  38. //                    ...|\\\\\\\\\\|...
  39. //                    ...|\\\\\\\\\\|...
  40. //                    ...|\\\\\\\\\\|...
  41. //                    ...|\\\\\\\\\\|...
  42. //                    ...|\\\\\\\\\\|...
  43. //                    ...|\\\\\\\\\\|...
  44. //                    ...|\\\\\\\\\\|...
  45. //                    .../**********\...
  46. //                    ../************\..
  47. //                    ./**************\.
Advertisement
Add Comment
Please, Sign In to add comment