Activity for Lundin
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #287816 |
Post edited: |
— | almost 2 years ago |
Comment | Post #287816 |
Example of what I mean. (more) |
— | almost 2 years ago |
Edit | Post #287816 | Initial revision | — | almost 2 years ago |
Answer | — |
A: How should we handle incorrect answers? ^ That can be used. You can try to contact the person who posted the challenge and have them mark the answer as "React -> Invalid". Or otherwise it seems that anyone can mark an answer as invalid? I think this was the original purpose of that feature for this site. The help text for the react... (more) |
— | almost 2 years ago |
Edit | Post #285821 |
Post edited: Typo |
— | almost 2 years ago |
Edit | Post #287540 | Initial revision | — | almost 2 years ago |
Answer | — |
A: Lowercase, but not just the letters [C (gcc)], 36 bytes f(intp){for(;p;putchar(32|p++));} Try it online! Similar solutions: - 36 bytes too but with new lines: `f(intp){for(;p;p|=32,puts(p++));}` - 37 bytes using recursion: `f(intp){p&&putchar(32|p)&&f(++p);}` (more) |
— | almost 2 years ago |
Edit | Post #287341 | Initial revision | — | about 2 years ago |
Answer | — |
A: Sort letters by height [C (gcc)], 152 bytes r;e(c){r=c=='j'?5:strchr("bdfghklpqy",c)?4:c=='i'?3:c=='t'?2:1;}c;s;f(chari,charo){s?(e(i),c=r,e(o)):(qsort(i,strlen(i),s=1,f),puts(i));return r-c;} Try it online! Output: ```text a aa jbita kitc now jtus jpyitzx ``` I didn't fine tune it much, ... (more) |
— | about 2 years ago |
Edit | Post #285929 |
Post edited: |
— | over 2 years ago |
Comment | Post #285929 |
@#56271 Indeed! I'll give it an update. (more) |
— | over 2 years ago |
Edit | Post #286603 |
Post edited: |
— | over 2 years ago |
Edit | Post #286651 |
Post edited: Recursion isn't always the best solution... |
— | over 2 years ago |
Edit | Post #286651 | Initial revision | — | over 2 years ago |
Answer | — |
A: Make a frequency table (histogram) [C (gcc)], 45, 42 bytes t[9999];f(s,a)inta;{for(;s;)t[a[--s]]++;} Try it online! Assumptions: - Passing the array size to a function can be used as a means to deal with empty arrays (not supported in C). - A table of integers can be regarded as a hashtable with an integer val... (more) |
— | over 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) |
— | over 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) |
— | over 2 years ago |
Edit | Post #286603 | Initial revision | — | over 2 years ago |
Article | — |
Code bowling using unique characters The aim of the challenge is to write as long a source code as possible (code bowling), every character typed gives 1 point, using the following rules: - No symbol typed in the source may be re-used twice. That is, only one `a`, only one `1`, only one `+` and so on. - Whitespace characters do not ... (more) |
— | over 2 years ago |
Edit | Post #286602 | Initial revision | — | over 2 years ago |
Answer | — |
A: Rules for function submissions Function parameters should not be allowed to be used in place of a return value. Reasons: - Terms like return value and function result are explicitly specified as a specific, formal language item in most languages. Therefore, interpreting a challenge asking for a return value as "return th... (more) |
— | over 2 years ago |
Edit | Post #286590 | Initial revision | — | over 2 years ago |
Answer | — |
A: Keyword golfing [C (gcc)], 358 bytes static inline Noreturn float f(union u);extern Threadlocal Complex long doublerestrict B;main(void){Atomic register enum {A};typedef Alignas(unsigned char)struct S;Staticassert(Alignof(Bool),"Imaginary");do goto a;while(sizeof B);if(1)for(auto volatile const signed sho... (more) |
— | over 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) |
— | over 2 years ago |
Edit | Post #286524 |
Post edited: |
— | over 2 years ago |
Edit | Post #286524 |
Post edited: Swapping loop for recursion shaved 3 bytes |
— | over 2 years ago |
Edit | Post #286524 | Initial revision | — | over 2 years ago |
Answer | — |
A: Roll n fair dice [C (gcc)], 48 43 bytes s;r(n,m){s+=rand()%m+1;return--n?r(n,m):s;} Try it online! Previous 48 bytes version using loop: `i,s;r(n,m){for(;i<n;i++)s+=rand()%m+1;return s;}` (more) |
— | over 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) |
— | over 2 years ago |
Comment | Post #284049 |
@#56561 Indeed. This answer is using gcc as indicated and isn't a strictly conforming answer. (more) |
— | over 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) |
— | over 2 years ago |
Edit | Post #286293 |
Post edited: TIO example contained lots of whitespace for some reason |
— | over 2 years ago |
Edit | Post #286293 | Initial revision | — | over 2 years ago |
Answer | — |
A: Looping counter [C (gcc)], 47 bytes i,n;f(){for(i=n+++2;i--;)putchar(i?42:13);f();} Try it online! (more) |
— | over 2 years ago |
Edit | Post #285929 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Can you give me half? [C (gcc)], 8 7 unique cos(cos-cos)/(cos(cos-cos)-(-cos(cos-cos))) Try it online! -1 unique character thanks to @orthoplex (more) |
— | almost 3 years ago |
Edit | Post #285263 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285821 | Initial revision | — | almost 3 years ago |
Question | — |
Keyword golfing Many programming languages have the concept of keywords, special syntax items that are not just identifiers reserved by some library, but words reserved by the language itself. The challenge is to write a minimal program for a language with such keywords, with as few characters as possible (code ... (more) |
— | almost 3 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) |
— | almost 3 years ago |
Edit | Post #285263 | Initial revision | — | almost 3 years ago |
Article | — |
Keyword golfing [FINALIZED] Many programming languages have the concept of keywords, special syntax items that are not just identifiers reserved by some library, but words reserved by the language itself. The challenge is to write a minimal program for a language with such keywords, with as few characters as possible (code ... (more) |
— | almost 3 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) |
— | almost 3 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) |
— | almost 3 years ago |
Comment | Post #284951 |
@#53588 I suppose these are names (of scores) so the first word should be a capital letter. (more) |
— | about 3 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) |
— | about 3 years ago |
Edit | Post #284951 | Initial revision | — | about 3 years ago |
Question | — |
Golf golf challenge 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 #284852 |
Post edited: |
— | about 3 years ago |
Comment | Post #284852 |
Yes par can only ever be 3, 4 or 5. (more) |
— | about 3 years ago |