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 celtschk‭

Type On... Excerpt Status Date
Question Multiply two strings
Given two strings, I define their product as follows: If any of the two strings is empty, the product is the empty string. If the second string consists of a single character, the result is obtained by replacing every character of the first string that compares larger than that character ...
(more)
about 3 years ago
Comment Post #283649 I just noticed that you put the encryption tag on this challenge. That is not appropriate; encryption means to encode a message so that only people with the correct decryption key can decode it. Decoding binary doesn't need a decryption key.
(more)
about 3 years ago
Comment Post #283652 Actually I started with a loop containing a single printf statement (but no width specifications; just a lot of `%1$s` style stuff), but then found that putting the singular/plural logic into a separate function saves more space because I essentially repeated the same logic for `i-1` as I couldn't de...
(more)
about 3 years ago
Comment Post #283649 If you don't care about negative integers, the best option would be to say that it may be assumed that the code is only called on non-negative integers.
(more)
about 3 years ago
Comment Post #283649 What about negative integers?
(more)
about 3 years ago
Edit Post #283652 Initial revision about 3 years ago
Answer A: 99 Shortened Bottles of Beer
[C (gcc)], 232 bytes f(n,w,p){printf("%i bottle%s of beer%s%s",n,"s"+(n1?"Take one down and pass it around, ":"Go to the store and buy some more, ");f(--i?:99,0,".\n\n");}} Try it online! Main golfing techniques: The repetitive part has been put into a function conditiona...
(more)
about 3 years ago
Comment Post #283649 You might want to restrict the input to disallow a “converter” that takes the number in binary and copies it to output unchanged.
(more)
about 3 years ago
Comment Post #283649 Why does the integer have to be named n?
(more)
about 3 years ago
Edit Post #283617 Initial revision over 3 years ago
Answer A: Evaluate a single variable polynomial equation
[C++ (gcc)], 61 bytes float f(int n,floatp,float x){return n?p+xf(n-1,p+1,x):0;} Try it online!
(more)
over 3 years ago
Edit Post #283603 Post edited:
Added that reversal of parameters is allowed if explicitly stated
over 3 years ago
Comment Post #283603 As long as you explicitly state that the second factor is passed in first, I'd consider that acceptable. I've edited the post accordingly.
(more)
over 3 years ago
Edit Post #283603 Post edited:
over 3 years ago
Edit Post #283603 Initial revision over 3 years ago
Article Multiply two strings [FINALIZED]
Given two strings, I define their product as follows: If any of the two strings is empty, the product is the empty string. If the second string consists of a single character, the result is obtained by replacing every character of the first string that compares larger than that character ...
(more)
over 3 years ago
Edit Post #281721 Initial revision over 3 years ago
Answer A: Golf a FRACTRAN interpreter
[Python 3], 76 71 bytes Saved 5 bytes thanks to user def f(p,n):l=[np//q for(p,q)in p if n%q<1];return f(p,l[0])if l else n Try it online! This code assumes that the fractions are given as completely cancelled pairs of integers.
(more)
over 3 years ago
Comment Post #279854 Figuring that out was intended to be part of the challenge? I would never have guessed *that.* The one single most important thing about a challenge is to be crystal clear on what is expected from a solution. Up to now, my comments were about things where people could be misled by reasonable assumpti...
(more)
almost 4 years ago
Comment Post #279854 On the `{n}=2n`: That's just an observation/extrapolation from the examples given. But the order you describe implies `m<n => {m} < {n]`, which means that when `{5} > {6}` then your mapping does not respect your order. While there's of course not a requirement to respect the order, it is what I woul...
(more)
almost 4 years ago
Comment Post #279854 According to the task description, the task is to return a string, not a set. I took it that your algorithm gives that string. So what you are saying is that the algorithm only gives *some* representation of the set, and the program has to then calculate the set from that representation, and then to ...
(more)
almost 4 years ago
Comment Post #279854 Also, what number corresponds to the set `{{{}, {{{}}}}}` (that is, `{5}`)? Up to n=4, the sets {n} seem to have ascending numbers (`{0}=1`, `{1}=2`, `{2}=4`, `{3}=6`, `{4}=8`), but then the next single-element set is `{6}=12`. Indeed, from those examples, it seems that `{n}=2n`, but `10={1,3}≠{5}`.
(more)
almost 4 years ago
Comment Post #279854 BTW, your algorithm produces strings without spaces, but your examples contain spaces after the commas. This raises the question of (a) whether those spaces should be generated, and (b) whether the code should handle such spaces and/or the absence of them in the input.
(more)
almost 4 years ago
Comment Post #279854 Since all strings are of finite length, only hereditary finite sets can be represented as such strings anyway. And even if you consider strings of countably infinite length, you obviously cannot represent all sets as such strings. I think a better strategy would be to define the “set strings” by thei...
(more)
almost 4 years ago
Comment Post #279854 I haven't completely gone through your algorithm, but I suspect what you define is the [Ackermann bijection](https://en.wikipedia.org/wiki/Hereditarily_finite_set#Ackermann%27s_bijection) between the natural numbers and the hereditary finite sets.
(more)
almost 4 years ago
Comment Post #279854 Your depth is called rank (see [here](https://math.stackexchange.com/a/458305/34930)). Note that the definition you give only works for finite sets, as in infinite sets there may not be a maximum, see the link for a definition that always works. Also, what you call “finite” is properly called heredit...
(more)
almost 4 years ago
Edit Post #279820 Post edited almost 4 years ago
Suggested Edit Post #279820 Suggested edit:
This is not kolmogorov-complexity, as it takes input
(more)
helpful almost 4 years ago
Comment Post #279722 This is not kolmogorov-complexity, as it takes input.
(more)
almost 4 years ago
Comment Post #279791 An explanation would be nice.
(more)
almost 4 years ago
Edit Post #279790 Initial revision almost 4 years ago
Question Generate Lewis Caroll's Jabberwocky
The task is to generate the text of Lewis Caroll's Jabberwocky. The text, quoted from Wikipedia, is as follows (I've replaced a non-ASCII character with ASCII, otherwise it's direct copy&paste from the linked Wikipedia article): ``` 'Twas brillig, and the slithy toves Did gyre and gimble in t...
(more)
almost 4 years ago
Edit Post #279666 Post edited:
almost 4 years ago
Comment Post #279253 @Razetime: You should probably add that as a test case, as several currently posted solutions fail in this case.
(more)
almost 4 years ago
Edit Post #279706 Initial revision almost 4 years ago
Answer A: Length of a Sumac Sequence
[C (gcc)], 32 bytes f(a,b){return a>0?f(b,a-b)+1:0;} Try it online!
(more)
almost 4 years ago
Comment Post #279253 What should be the result for t1=t2=0?
(more)
almost 4 years ago
Edit Post #279666 Initial revision almost 4 years ago
Article Generate Lewis Caroll's Jabberwocky [FINALIZED]
The task is to generate the text of Lewis Caroll's Jabberwocky. The text, quoted from Wikipedia, is as follows (I've replaced a non-ASCII character with ASCII, otherwise it's direct copy&paste from the linked Wikipedia article): ``` 'Twas brillig, and the slithy toves Did gyre and gimble in t...
(more)
almost 4 years ago
Edit Post #279629 Post edited:
I forgot to replace some variable names in the ungolfed version; also improved formatting of that version slightly
almost 4 years ago
Edit Post #279629 Post edited:
ungolfed/commented version
almost 4 years ago
Edit Post #279629 Initial revision almost 4 years ago
Answer A: Given the preorder and the inorder of a tree, output the postorder
[C (gcc)], 114 bytes f(int n,intp,inti,into){if(n){intm=i,k;for(;m!=p;++m);k=m-i;f(k,p+1,i,o);f(n-k-1,p+k+1,m+1,o);(o)++=p;}} Try it online! Arguments: `n` is the length of the arrays `p` is the preorder array `i` is the inorder array `o` is a pointer to a pointer t...
(more)
almost 4 years ago
Comment Post #279425 You can save 7 bytes by replacing `'SIGSEGV'` with `11` (the signal number of SIGSEGV).
(more)
almost 4 years ago
Comment Post #279141 Is it intentional that this community is not listed on the [main page?](https://codidact.com/) (I already commented about that on the proposal post, but I guess that was the wrong place for that comment)
(more)
about 4 years ago
Edit Post #279407 Initial revision about 4 years ago
Article Run-length encode a byte sequence [FINALIZED]
Run-length encoding is a simple compression technique which compresses sequences of repeating identical bytes. The encoding rules for this task are as follows: Any sequence of $n$ identical bytes ($3 \leq n \leq 63$) is replaced by a byte with value `n+0xc0` followed by only one copy of that by...
(more)
about 4 years ago
Edit Post #279383 Post edited:
Added ungolfed version of the code with explanation in the comments
about 4 years ago
Edit Post #279383 Initial revision about 4 years ago
Answer A: 1, 2, Fizz, 4, Buzz!
C (gcc), 113 Bytes ``` i;main(){while(i++ / Declare a global int variable. The golfed code omits the type because of the old implicit-int rule, which only generates a warning also in modern gcc. Also note that global variables without initializer are zero-initialized; this is sti...
(more)
about 4 years ago