Activity for Lundinâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #284852 |
@#8056 Thanks, I added one. (more) |
— | about 3 years ago |
Edit | Post #284852 |
Post edited: |
— | about 3 years ago |
Edit | Post #284852 | Initial revision | — | about 3 years ago |
Article | — |
Golf golf challenge [FINALIZED] The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line: - The first number is the par of the specific hole. - The second number is the score that the player got. The program should print the textual golf term for the re... (more) |
— | about 3 years ago |
Edit | Post #284705 | Initial revision | — | about 3 years ago |
Answer | — |
A: Reactions on Code Golf Codidact None of these are applicable at least not for Code Golf challenges. I think this community should "opt out" of reactions unless we can come up with more relevant ones. - "Works for me". Answers are supposed to live up to the challenge specification - if they don't, then one should use comments to ... (more) |
— | about 3 years ago |
Edit | Post #284534 |
Post edited: |
— | about 3 years ago |
Edit | Post #284534 | Initial revision | — | about 3 years ago |
Answer | — |
A: Operation "Find The Operator" [C (gcc)], 147 151 bytes #define L(X)X(+,a+b)X(-,a-b)X(,ab)X(/,b&&a/b)X(%,b&&a%b)X(^,pow(a,b)) #define M(o,d)printf("%s",d==c?#o" ":z++==5?".":""); z;s[99];f(a,b,c){L(M)} Try it online! Somewhat naive solution with X macros that builds up a string before printing. The `... (more) |
— | about 3 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) |
— | about 3 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) |
— | about 3 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) |
— | about 3 years ago |
Edit | Post #284326 | Initial revision | — | about 3 years ago |
Article | — |
Bird is the word Make a program that prints the lyrics of the first verse of Surfin' Bird by the Trashmen: > A-well-a everybody's heard about the bird B-b-b-bird, b-bird's the word A-well, a bird, bird, bird, bird is the word A-well, a bird, bird, bird, well-a bird is the word A-well, a bird, bird, b... (more) |
— | about 3 years ago |
Edit | Post #284106 | Initial revision | — | about 3 years ago |
Answer | — |
A: Repeat the characters [C (gcc)], 56 bytes i;f(s,n)chars,n;{for(;s;s++)for(i=n;i--;putchar(s));} Try it online! My attempt at recursion ended up at 61 bytes: o;f(s,n)chars,n;{for(o=n;s&&n--;putchar(s));s&&f(++s,o);} I still think there's probably a more elegant way to solve both loops wit... (more) |
— | about 3 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) |
— | about 3 years ago |
Edit | Post #284087 | Initial revision | — | about 3 years ago |
Answer | — |
A: Can we have [popularity-contest]s? Well... maybe not in combination with a code golf challenge, but more like an artistic challenge with some theme, similar to screenshot of the month? For reference see for example Outdoors photo contest or Writing challenges. So rather than giving a detailed specification of what the program must ... (more) |
— | about 3 years ago |
Edit | Post #279657 |
Post edited: |
— | about 3 years ago |
Edit | Post #279657 |
Post edited: |
— | about 3 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) |
— | about 3 years ago |
Edit | Post #284084 | Initial revision | — | about 3 years ago |
Answer | — |
A: Default Rules: Code Golf I/O Command-line arguments may be used as input instead of stdin Languages/systems that support reading input from command-line arguments may use those as input instead of reading from stdin. (more) |
— | about 3 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) |
— | about 3 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) |
— | about 3 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) |
— | about 3 years ago |
Edit | Post #284049 | Initial revision | — | about 3 years ago |
Answer | — |
A: "Hello, {name}!" [C (gcc)], 43 bytes a[99];main(){printf("Hello, %s!",gets(a));} Try it online! (more) |
— | about 3 years ago |
Comment | Post #283770 |
_Must_ it be a function or are function-like macros allowed (in case of C)? (more) |
— | about 3 years ago |
Edit | Post #284048 |
Post edited: |
— | about 3 years ago |
Edit | Post #284048 | Initial revision | — | about 3 years ago |
Answer | — |
A: Make $2 + 2 = 5$ [C (gcc)], 30 bytes f(x,y){return x+y|!(x^y|x^2);} Try it online! In case the "preferably on a function" requirement can be dropped, then #define f(x,y)x+y|!(x^y|x^2) is 28 bytes. (more) |
— | about 3 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 3 years ago |
Comment | Post #283864 |
Same solution: `f(n){n&&f(n/2);putchar(n&1|48);}` (more) |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Comment | Post #283736 |
@#54114 I'm decent at C programming but still a beginner at code golfing :) (more) |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: Oh hey, printf happens to return 3 in this case. This is some truly evil code... :) |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: Move the first print to the first condition of inner for loop. Lose && but adds a , |
— | over 3 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 3 years ago |
Edit | Post #283738 | Initial revision | — | over 3 years ago |
Article | — |
Pass a value through different memory sections Lets get a bit closer to the metal than usual! The task is to pass a constant value between the different data memory sections of a typical computer. For this challenge you need a system and language which allows you to allocate variables in all of the following sections (using ELF notation): ... (more) |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Edit | Post #283736 |
Post edited: |
— | over 3 years ago |
Edit | Post #283736 | Initial revision | — | over 3 years ago |