Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

77%
+5 −0
Challenges Print the Great Numeric Pyramid

JavaScript (Node.js), 137 136 117 bytes with(Math)f=n=>(m=(a,b)=>a?m(--a,b)+b(a):[])(28,y=>m(55,x=>x>26-y&x<y+28&(x^y)?min(abs(abs(27-x)-y)/2,27-y):' ')+` `) Try it...

posted 4y ago by Hakerh400‭  ·  edited 4y ago by Hakerh400‭

Answer
#3: Post edited by user avatar Hakerh400‭ · 2020-11-18T14:18:06Z (about 4 years ago)
  • # [JavaScript (Node.js)], <del>137</del> 136 bytes
  • <!-- language-all: lang-javascript -->
  • with(Math)f=n=>(a=(a,b)=>[...Array(a)].map((a,d)=>b(d)).join``)(28,y=>a(55,x=>x>26-y&x<y+28&(x^y)?min(abs(abs(27-x)-y)/2,27-y):' ')+`
  • `)
  • [Try it online!][TIO-khgz2n3w]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-khgz2n3w]: https://tio.run/##HcnfCoIwFIDx@56iKz2HdMHAkmiLHqAniMLjP5zgJtvK7elNuvjgg99IX3KNVbPPtWm7dV2UH@BBfsBeaCGBBFBWo5BPxtjdWopA@GITzbBBu0ENLSIbjdJVhcDLLApJUBRZEDJIfspjEq7xwMsEwjvibVIaqHb/@DkPmEc88mzbiJd0n@Kh2lW4ztY0nXPM@dZ8PFus8h30gLj@AA "JavaScript (Node.js) – Try It Online"
  • # [JavaScript (Node.js)], <del>137</del> <del>136</del> 117 bytes
  • <!-- language-all: lang-javascript -->
  • with(Math)f=n=>(m=(a,b)=>a?m(--a,b)+b(a):[])(28,y=>m(55,x=>x>26-y&x<y+28&(x^y)?min(abs(abs(27-x)-y)/2,27-y):' ')+`
  • `)
  • [Try it online!][TIO-khnhmz7f]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-khnhmz7f]: https://tio.run/##HcbdCoIwFADg@56iKz0HN4OBJdLmE/QEUXg0xQVTcSu3p18/Fx98T3qT7Va9OD7Njz7GTbsRLuRGHOQkFRgJxFqUimoDnP@etUBYXW8IomRBKgNFwbxUXokjD4k/h0yUCfh7wNroCai1f@LEPfKAB8G@DVil@xSzZtdgXNa5663NrXvML5dvq3Y9DIAYPw "JavaScript (Node.js) – Try It Online"
#2: Post edited by user avatar Hakerh400‭ · 2020-11-16T15:54:24Z (about 4 years ago)
  • # [JavaScript (Node.js)], 137 bytes
  • <!-- language-all: lang-javascript -->
  • with(Math)f=n=>(a=(a,b)=>[...Array(a)].map((a,d)=>b(d)).join``)(28,y=>a(55,x=>x>26-y&x<y+28&(x^y)?min(abs(abs(27-x)-y)/2,27-y):' ')+'\n')
  • [Try it online!][TIO-khgz2n3w]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-khgz2n3w]: https://tio.run/##HcntCoIwFIDhW@mXnoNuwcCKaIsuoCvoA49fOMEp28rt6k368cILz0BfcrXVs2dmatp1XbTv4U6@x04aqYAkUF6hVA/O@c1aikD44iPNsEGzQQUNIh8mbcoSQZzyKBVBUeRBqqDEgcUkXGImTgmEd8TrqA1Q5f6JIwvIIu5Fvm3Ec7pLMUufJsV1tlPdOsedb6aP54vVvoUOENcf "JavaScript (Node.js) – Try It Online"
  • # [JavaScript (Node.js)], <del>137</del> 136 bytes
  • <!-- language-all: lang-javascript -->
  • with(Math)f=n=>(a=(a,b)=>[...Array(a)].map((a,d)=>b(d)).join``)(28,y=>a(55,x=>x>26-y&x<y+28&(x^y)?min(abs(abs(27-x)-y)/2,27-y):' ')+`
  • `)
  • [Try it online!][TIO-khgz2n3w]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-khgz2n3w]: https://tio.run/##HcnfCoIwFIDx@56iKz2HdMHAkmiLHqAniMLjP5zgJtvK7elNuvjgg99IX3KNVbPPtWm7dV2UH@BBfsBeaCGBBFBWo5BPxtjdWopA@GITzbBBu0ENLSIbjdJVhcDLLApJUBRZEDJIfspjEq7xwMsEwjvibVIaqHb/@DkPmEc88mzbiJd0n@Kh2lW4ztY0nXPM@dZ8PFus8h30gLj@AA "JavaScript (Node.js) – Try It Online"
#1: Initial revision by user avatar Hakerh400‭ · 2020-11-14T00:51:18Z (about 4 years ago)
# [JavaScript (Node.js)], 137 bytes

<!-- language-all: lang-javascript -->

    with(Math)f=n=>(a=(a,b)=>[...Array(a)].map((a,d)=>b(d)).join``)(28,y=>a(55,x=>x>26-y&x<y+28&(x^y)?min(abs(abs(27-x)-y)/2,27-y):' ')+'\n')

[Try it online!][TIO-khgz2n3w]

[JavaScript (Node.js)]: https://nodejs.org
[TIO-khgz2n3w]: https://tio.run/##HcntCoIwFIDhW@mXnoNuwcCKaIsuoCvoA49fOMEp28rt6k368cILz0BfcrXVs2dmatp1XbTv4U6@x04aqYAkUF6hVA/O@c1aikD44iPNsEGzQQUNIh8mbcoSQZzyKBVBUeRBqqDEgcUkXGImTgmEd8TrqA1Q5f6JIwvIIu5Fvm3Ec7pLMUufJsV1tlPdOsedb6aP54vVvoUOENcf "JavaScript (Node.js) – Try It Online"