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

Type On... Excerpt Status Date
Comment Post #290437 In case of for example the first `1`, there are zero identical numbers preceding it. So how does it become `1` and not `0`? Shouldn't the text rather say "the number of identical integers preceding it, including itself" or something like that.
(more)
5 months ago
Comment Post #289996 Also check out [Integer to Roman numeral](https://codegolf.codidact.com/posts/279820).
(more)
7 months ago
Comment Post #289436 Would it be allowed to make the output format in binary?
(more)
9 months ago
Comment Post #285821 @#64628 I think the first sentence of the challenge already explains this pretty well.
(more)
9 months ago
Comment Post #285821 @#64628 This is defined by the official programming language specification. Like in the example given, by the ISO standard. Some languages might not have one (most esoteric programming languages don't) and then this challenge might not be suitable for that language.
(more)
9 months ago
Comment Post #285821 The program is free to do any form of input/output.
(more)
9 months ago
Comment Post #287540 Using the return value always seemed like cheating to me, unless the challenge says otherwise. I think our default rules allow it though(?).
(more)
9 months ago
Comment Post #286362 f(1,4) returns 5 so your solution is not correct... Similarly this algorithm is wrong in many other answers you have posted here too. To use your own math example, the correct algorithm would have to be `result = x*y; if(result==x+y) return 5; else return x*y;`.
(more)
9 months ago
Comment Post #279657 Well as it says in the (several years old) answer, I had no idea which system I got it running on when I did the edit. Might have been gcc/mingw/Windows. Anyway, probably best to refer to the function-only version.
(more)
9 months ago
Comment Post #279657 I think it might depend on which standard lib that is used (libc/glibc and so on). The revised 53 byte version should be pure standard C however.
(more)
9 months ago
Comment Post #287816 Example of what I mean.
(more)
over 1 year ago
Comment Post #285929 @#56271 Indeed! I'll give it an update.
(more)
almost 2 years ago
Comment Post #286630 Given that many languages do not support empty arrays, then how to deal with the `{ }` scenario in those languages?
(more)
almost 2 years ago
Comment Post #286603 @#53196 Yes well you'll have to use as many special characters as possible. You've already blocked yourself from using `if`, `else`, `for` and `while` now :) And if function solutions aren't allowed, you'll have to use `main` so you can't use `ifdef`. I honestly have no idea how good/bad hard/easy th...
(more)
almost 2 years ago
Comment Post #282785 I think we should clarify the meaning of "return value". Going by the formal terms of most languages, it's the value explicitly returned by the function. Many languages support pass by reference and then you can in practice return values through arguments, but this is not the language definition of a...
(more)
almost 2 years ago
Comment Post #286394 Testing the original program is easy enough, but how do we test that an infinite amount of programs are unique? It seems that this would be a challenge where lots of people claim to have solved it, and then upon closer investigation perhaps they haven't. With a finite amount of programs created, it w...
(more)
almost 2 years ago
Comment Post #284049 @#56561 Indeed. This answer is using gcc as indicated and isn't a strictly conforming answer.
(more)
almost 2 years ago
Comment Post #286377 The challenge explicitly said to produce an infinite loop. Any answer implementing a size parameter is therefore not following the requirement, for that reason alone. I remember misunderstanding it at first and making a solution based on a finite counter based on user input. Perhaps it should have be...
(more)
almost 2 years ago
Comment Post #285675 Sounds fun, I take it the ASCII art will expand in width and size depending on size? I think it probably needs some twist so that it isn't as easy as counting the number of rows and columns. Maybe include different shirt models? Or tops, if shirt models are too tricky to draw in ASCII art? As in "is ...
(more)
over 2 years ago
Comment Post #285064 @#8046 https://tio.run/# for info (click logo upper left corner). They are as far as I can tell a non-profit open source organization just like us, so they should have more in common with Codidact than with SE. I could poke around (they have a chat on SE), but it's probably better if an official repr...
(more)
over 2 years ago
Comment Post #285064 The most common answer form we use here is the tio.run "Code Golf Submission (Stack Exchange)". We could ask them if they would be so kind to update this part to "Code Golf Submission (Stack Exchange or Codidact.com)". A small change that doesn't seem unreasonable and we get free advertising whenever...
(more)
over 2 years ago
Comment Post #284951 @#53588 I suppose these are names (of scores) so the first word should be a capital letter.
(more)
over 2 years ago
Comment Post #284952 A minor (non-conforming) improvement for gcc would be to swap the `char*` with an `int*`. `*t="the whole string";f(p,s){ ...` shaves down 4 bytes.
(more)
over 2 years ago
Comment Post #284852 Yes par can only ever be 3, 4 or 5.
(more)
over 2 years ago
Comment Post #284852 @#8056 Thanks, I added one.
(more)
over 2 years ago
Comment Post #284407 In case multiple operators match, shouldn't it print all operators that would give the result. That is, the correct output from `2 2 4` should be `+ *`, or perhaps optionally `* +` (the order doesn't matter as long as it prints all results). This would make quite the difference for the algorithm, sin...
(more)
over 2 years ago
Comment Post #282795 @#8056 But what if the language has it but doesn't use it in the specific program. "Turing machine" is not a description of a programming language, but of a program running on a computer. Also there's the terminology confusion with Turing complete. Again, too vague.
(more)
over 2 years ago
Comment Post #284326 @#8056 That might be true. I just wanted something fairly repetitive, so that it would make sense to "optimize" certain parts of the string printing. Regardless, since Codidact is a non-profit organization and earns no money from the site, I'm not sure how copyright matters long as you state the sour...
(more)
over 2 years ago
Comment Post #284084 @#53503 No, or you would be able to read them with an input function the first thing you do when launching a program. Stdin is kind of an artificial concept too, mostly related to old terminal I/O.
(more)
over 2 years ago
Comment Post #283946 Not sure what a popularity contest is in this context. Do you mean a leader board based on vote score rather than characters used? Answers are already sorted by vote score by default, I believe.
(more)
over 2 years ago
Comment Post #282792 I disagree, this isn't necessarily printed anywhere meaningful. I think each challenge needs to explicitly specify that this is are allowed, or it shouldn't be allowed.
(more)
over 2 years ago
Comment Post #282795 While I agree in principle for languages without convenient input, this is too vague to actually be helpful. For example the "tape" could be a previously defined constant, in which case languages which do support stdin would be free to abuse that rather than taking input. Example of such abuse in C l...
(more)
over 2 years ago
Comment Post #284049 @#53588 You can't store input in thin air, you need to allocate memory for it. Otherwise the program might crash arbitrary. Also `[];` isn't valid C.
(more)
over 2 years ago
Comment Post #283770 _Must_ it be a function or are function-like macros allowed (in case of C)?
(more)
over 2 years ago
Comment Post #283917 @#53588 It might be worth keeping discussions archived at least for a few weeks after a new challenge is released. In case anyone has questions they might be able to go check the reasoning behind some rule in the sandbox. In the long term I agree that finalised sandbox drafts hold no value.
(more)
over 2 years ago
Comment Post #283864 Same solution: `f(n){n&&f(n/2);putchar(n&1|48);}`
(more)
over 2 years ago
Comment Post #283736 @#54114 I'm decent at C programming but still a beginner at code golfing :)
(more)
over 2 years ago
Comment Post #283716 @#54114 I think the fastest code is an interesting idea, though for this to work out we'd have to come up with a standardized way to benchmark the code, preferably online in TIO. That probably means that challenges will be restricted to one particular language. Ideally, all answers are expected to pr...
(more)
over 2 years ago
Comment Post #283649 It should say "Take input of a non-negative _decimal_ integer". Also, many languages have conversion functions so this will mostly be about passing input to a conversion function and print it. Or print straight away using binary notation if the language supports it.
(more)
over 2 years ago
Comment Post #283652 I'm realizing that your neat `"s"+(n<2)` trick would have shaved down my own solution quite a bit, but I'll refrain from shamelessly stealing it :) I have lots of stuff like `%.*s` `i-1?8:7,w` (print 7 characters of the string w otherwise 8) which didn't turn out too compact.
(more)
over 2 years ago
Comment Post #283652 Seems we were working on this simultaneously in C but you beat me with 12 :) Completely different solutions, I went bananas on the printf format string instead.
(more)
over 2 years ago
Comment Post #279159 Wouldn't each example have two answers? Since it's a quadratic equation and solving x^2 gives 2 roots.
(more)
over 2 years ago
Comment Post #283432 I think `C (gcc)` already implies gcc compiler extensions. Or that's how we have been using it until now, at least. It would be cumbersome to change that now.
(more)
over 2 years ago
Comment Post #283380 @#54114 Again, this is a strictly conforming solution. The includes need to be there or it won't compile. Similarly implicit int was removed from the language.
(more)
over 2 years ago
Comment Post #283380 @#53588g As for the TIO, I wished to test with the worst test case that takes some serious amount of input. I couldn't be bothered to add them one by one to TIO.
(more)
over 2 years ago
Comment Post #283380 @#53588 This is a strictly conforming solution, meaning it has to be fully standard compliant and with no poorly-defined behavior. It's not using gcc extensions, just standard C.
(more)
over 2 years ago
Comment Post #282238 `main(){printf("$");main();}` This program creates stack overflow, takes no input from the community and gives lots of dollar signs as output for a short while, until the inevitable crash happens. On a serious note, can't we come up with something more original than copy paste of existing challenges ...
(more)
over 2 years ago
Comment Post #282821 Examples like the above seem like valid clever tricks that should be encouraged rather than forbidden.
(more)
over 2 years ago
Comment Post #282821 If there is to be such a rule, it needs to be more specific. In C and C++ you have various tricks such as [the #line directive](https://godbolt.org/z/nrxGaqP4W) which can be used to trick the program into thinking the file name is something else - might be handy in some scenarios. There's also the ar...
(more)
over 2 years ago
Comment Post #282952 In case of the value zero specifically, `i` is guaranteed to already be zero even in strictly conforming C, since it has static storage duration. So maybe use some other number for example :)
(more)
over 2 years ago