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 »

Activity for Zakk‭

Type On... Excerpt Status Date
Answer A: Can you give me half?
Lua 5.4, 3 unique characters ``` lua #'#'/#'##' ``` Try it online! > [...] scoring is done in terms of number of unique characters used in the submission. 1. Hashtag # 2. Single quote ' 3. Slash /
(more)
about 2 years ago
Edit Post #286329 Initial revision about 2 years ago
Answer A: The Pell Numbers
C (gcc), 35 bytes ``` C f(n){return n<2?n:f(n-1)2+f(n-2);} ``` Try it online!
(more)
about 2 years ago
Edit Post #286328 Initial revision about 2 years ago
Answer A: The Pell Numbers
Lua 5.4.4, 51 bytes ``` lua function f(n)return n<2 and n or f(n-1)2+f(n-2)end ``` Try it online!
(more)
about 2 years ago
Edit Post #286324 Initial revision about 2 years ago
Answer A: Write a Deadfish Interpreter
JavaScript (V8), 78 bytes ``` javascript f=s=>s.map(c=>(==256||<0?=0:0)||c=='i'?++:c=='d'?--:c=='s'?=:v+=+' ') ``` Try it online!
(more)
about 2 years ago
Edit Post #286321 Initial revision about 2 years ago
Answer A: Write a Deadfish Interpreter
C (gcc), 98 bytes ``` c =0;f(chars){for(;s;++s)==256||<0?=0:1,s=='i'?++:s=='d'?--:s=='s'?=:printf("%d ",);} ``` Try it online!
(more)
about 2 years ago
Comment Post #286311 Though both of `s:gsub` and `for..in` versions are equal in length, the former can be one byte shorter, because sticking an `s` to `0` doesn't make the Lua interpreter unhappy, contrary to sticking an `f` to `0`. ``` _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[...
(more)
about 2 years ago
Edit Post #286311 Post edited:
shortened the code (thanks to orthoplex)
about 2 years ago
Comment Post #286311 > ```_=(_==256or _<0)and 0or _``` You are right. > Tables to the rescue ^^ Man! That's just brilliant! Again, thanks for pointing this out. Btw, I am really curious about how much experience you have with Lua.
(more)
about 2 years ago
Edit Post #286301 Post edited:
shortened the code (thanks to orthoplex)
about 2 years ago
Comment Post #286301 Clever solution! Thanks!
(more)
about 2 years ago
Edit Post #286311 Initial revision about 2 years ago
Answer A: 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.
(more)
about 2 years ago
Edit Post #286301 Post edited:
shortened the code (thanks to orthoplex)
about 2 years ago
Comment Post #286301 > If your function never runs, then clearly it won't have a runtime error :) @#53196 So calling `f()` is not necessary... If so, I will remove it.
(more)
about 2 years ago
Comment Post #286301 @#56271 You are right! It can be shortened (and it prints `nil nil`). Strange how I missed this one out. Anyways, thanks (once more) for pointing this out!
(more)
about 2 years ago
Edit Post #286301 Post edited:
shortened the code (thanks to orthoplex)
about 2 years ago
Comment Post #286301 > You can shorten your for-loop No, I can't. Shortening it the way you did results in omitting the `in` keyword. This obviously goes against the rule of including **all** language keywords. > and save a few spaces on the numerical constants Yes, that's true. I will edit my answer. Thanks (ag...
(more)
about 2 years ago
Edit Post #286300 Post edited:
shortened the code (thanks to orthoplex)
about 2 years ago
Comment Post #286300 Thanks! I will edit the code.
(more)
about 2 years ago
Edit Post #286301 Initial revision about 2 years ago
Answer A: 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 the list of keywords. Thanks to @orthoplex for more shortening.
(more)
about 2 years ago
Edit Post #286300 Post edited:
Provided a link to try it online.
about 2 years ago
Edit Post #286300 Initial revision about 2 years ago
Answer A: Looping counter
Lua, 31 bytes ``` =''::::=..''print()goto ``` Try it online!
(more)
about 2 years ago