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 »

Posts by Zakk‭

19 posts
77%
+5 −0
Challenges Looping counter

Lua, 31 bytes _=''::_::_=_..'*'print(_)goto _ Try it online!

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
66%
+2 −0
Challenges Write a Deadfish Interpreter

Lua 5.4.4, 99 bytes _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[-1]=0})[_]or _ end) Try it online! Thanks to @orthoplex for more shortening.

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
66%
+2 −0
Challenges Can you give me half?

Lua 5.4, 3 unique characters #'#'/#'##' Try it online! [...] scoring is done in terms of number of unique characters used in the submission. Hashtag # Single quote ' Slash /

posted 2y ago by Zakk‭

Answer
66%
+2 −0
Challenges Collatz conjecture; Count the tries to reach $1$

Lua 5.4, 67 60 bytes function(x)return x==1 and 0 or 1+f(({x/2,3*x+1})[x%2+1])end Attempt This Online! Credits to @Moshi for more shortening.

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
60%
+1 −0
Challenges Keyword golfing

Lua 5.4.4, 147 bytes local function f()goto l::l::return end for _ in f do end if true and false then elseif""then else end repeat until""or not nil while""do break end Try it online! Check th...

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
60%
+1 −0
Challenges Write a Deadfish Interpreter

C (gcc), 98 bytes _=0;f(char*s){for(;*s;++s)_==256||_<0?_=0:1,*s=='i'?_++:*s=='d'?_--:*s=='s'?_*=_:printf("%d ",_);} Try it online!

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
60%
+1 −0
Challenges Collatz conjecture; Count the tries to reach $1$

C (gcc), 43 38 bytes f(i){return i>1?f(i%2?3*i+1:i/2)+1:0;} Attempt This Online! Credits to @Moshi for shortening the code.

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
60%
+1 −0
Challenges Create a range grid

C (gcc), 59 bytes i;f(m,n){while(i<m*n){putchar(i%n?32:13);putchar(48+i++);}} Attempt This Online! m is the number of rows. n is the number of columns.

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
57%
+2 −1
Challenges Make $2 + 2 = 5$

C (gcc), 41 bytes f(x,y){int r=x*y;return r&&r==x+y?5:x+y;} Attempt This Online!

posted 2y ago by Zakk‭  ·  edited 4mo ago by Zakk‭

Answer
50%
+0 −0
Challenges Make a frequency table (histogram)

Lua, 98 bytes function(t)r={}for k,v in pairs(t)do r[v]=0 end for k,v in pairs(t)do r[v]=r[v]+1 end return r end Attempt This Online!

posted 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges Word Count Tool

JavaScript (Node.js), 60 bytes s=>[/\w+/g,/./g,/[\S\t]/g].map(p=>(v=s.match(p))?v.length:0) Attempt This Online!

posted 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges Word Count Tool

Lua 5.4, 62 bytes _,w=s:gsub('%w+',0)_,c=s:gsub('[^\n]',0)_,n=s:gsub('[%g\t]',0) Attempt This Online! Another version, 65 bytes: p={'%w+','[^\n]','[%g\t]'}for i=1,#p do _,r[i]=s:gsub(p[i],'...

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges Create a range grid

Lua 5.4, 76 bytes function(m,n)for i=0,m*n-1 do _=(i%n==0)and print()or io.write(i,' ')end end Try it online!

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges It's Hip to be Square

C (gcc), 37 bytes f(n,p){while(++p*p<n);return p*p==n;} Try it online! The solution is based on the simple fact that: $$\forall n \in \mathbb{N}, n \text{ is a perfect square} \Longleftrig...

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges It's Hip to be Square

Lua 5.4, 9 bytes n^.5%1==0 Try it online! The entire compressed code is 33 bytes: function f(n)return n^.5%1==0 end Try it here. It's not clear whether the rules allow the first form (i...

posted 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges It's Hip to be Square

JavaScript (V8), 13 bytes x=>x**.5%1==0 Try it online!

posted 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges The Pell Numbers

C (gcc), 35 bytes f(n){return n<2?n:f(n-1)*2+f(n-2);} Try it online!

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges The Pell Numbers

Lua 5.4.4, 51 bytes function f(n)return n<2 and n or f(n-1)*2+f(n-2)end Try it online!

posted 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges Write a Deadfish Interpreter

JavaScript (V8), 78 bytes f=s=>s.map(c=>(_==256||_<0?_=0:0)||c=='i'?_++:c=='d'?_--:c=='s'?_*=_:v+=_+' ') Try it online!

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer