Activity for celtschk
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #287387 |
What character set are you using that those three characters fit in three bytes?
(more) |
— | over 1 year ago |
Comment | Post #287054 |
This gives 3 for input 10: should be 2. (more) |
— | over 1 year ago |
Comment | Post #287050 |
It is customary here that if you improve the code, you show the previous byte count in strike-through before the new byte count. See e.g. [Shaggy's JavaScript answer](https://codegolf.codidact.com/posts/287035/287045#answer-287045) for an example. Note that the leaderboard correctly identifies the va... (more) |
— | over 1 year ago |
Comment | Post #287044 |
Indeed, it can be seen from the description of the code: The result with ordinary conversion is zero if and only if all digits are zero. In that case, the second operand of or applies, which is just the length. Very clever.
(more) |
— | over 1 year ago |
Comment | Post #287044 |
This doesn't correctly handle the unary special case. (more) |
— | over 1 year ago |
Comment | Post #287040 |
I think it would make sense to set a limit on the inputs the program needs to handle. For example, a limit on the maximal length of the input, or on the maximal produced numerator and denominator. (more) |
— | over 1 year ago |
Comment | Post #287026 |
Note that there's [another meta post](https://codegolf.codidact.com/posts/283917) relevant in this context.
(more) |
— | over 1 year ago |
Comment | Post #287005 |
My take on the sandbox questions:
* I think empty input should be allowed, with truthy value.
* I think allowing other forms of input is a good idea. In particular, I would allow lists/arrays of strings, and 2D arrays of characters.
* An upper limit in the size the program needs to han... (more) |
— | over 1 year ago |
Comment | Post #287005 |
You didn't specify what should happen if there are more than two letters in the input, e.g.
```
aabbcc
aabbcc
```
I guess the intention is that this would be a falsy result, but you didn't specify.
**Edit:** I now notice that there are test cases for that; however explicitly stating it would ... (more) |
— | over 1 year ago |
Comment | Post #286989 |
Can't you make an exhaustive list of all potential solutions? (more) |
— | over 1 year ago |
Comment | Post #286882 |
How is this 5 bytes?
I count 12 letters, each of which requires one byte. (more) |
— | over 1 year ago |
Comment | Post #286362 |
But the task asks for integers ($\mathbb Z$), not natural numbers ($\mathbb N$). Thus the code should give $(-2)+(-2)=-4$ while yours gives $(-2)+(-2)=5$. (more) |
— | almost 2 years ago |
Comment | Post #286427 |
What should the content of the generated image be? As written, one might completely ignore the image content and generate a blank image of the required size.
And what exactly counts as metadata stored in the image that is used to help the program? If the image format explicitly contains the image ... (more) |
— | almost 2 years ago |
Comment | Post #286424 |
You don't need the `Floor` here. When dividing an even integer by 2, Mathematica automatically gives an integer. Also, the space in `3 #` is unnecessary. And `#!=1` can be replaced by `#>1`. (more) |
— | almost 2 years ago |
Comment | Post #286377 |
I've now added a [separate question](https://codegolf.codidact.com/posts/286401) about whether the tag would be appropriate. (more) |
— | almost 2 years ago |
Comment | Post #286283 |
I just let it run on TIO, and it outputted two of the lines switched. You can easily fix that without changing the length by replacing `&` with `;` which removes the concurrency. (more) |
— | almost 2 years ago |
Comment | Post #286377 |
Does kolmogorov-complexity apply to infinite loop output?
Anyway, this question, while referring that specific challenge, is more general: The same would apply e.g. to a challenge where you are asked to calculate something based on a single input variable, and the solution takes a second argument ... (more) |
— | almost 2 years ago |
Comment | Post #286240 |
Any printable, non-whitespace character should do. I'll edit accordingly. (more) |
— | about 2 years ago |
Comment | Post #285479 |
The straightforward `n%(i*i)==0` would be shorter than your double equality. Moreover, you then could remove the `==0` by replacing `1in` with `0in`, saving another 3 bytes. (more) |
— | over 2 years ago |
Comment | Post #285479 |
Well, it is a code golf challenge, not a run time challenge.
BTW, I suspect that dividing by all the single factors (your re-assignment of `n`) does *not* make your code faster, but slower. Anyway, it definitely makes it longer. (more) |
— | over 2 years ago |
Comment | Post #285477 |
I've added a few. (more) |
— | over 2 years ago |
Comment | Post #285477 |
Thanks for pointing this out; I've added the link to the post. (more) |
— | over 2 years ago |
Comment | Post #285231 |
If I read the Wikipedia article correctly, there does *not* exist a finite projective plane for each $n$ up to $11$. In particular, $n=6$ and $n=10$ are cases that are known not to work. (more) |
— | over 2 years ago |
Comment | Post #285273 |
@m90: Thanks, adopted. (more) |
— | over 2 years ago |
Comment | Post #284994 |
Your capitalisation is wrong. That's easy to fix in “Hole in one”, but changing the capitalisation of “Double bogey”/“Triple bogey” without changing “Bogey” as well surely makes the code longer. (more) |
— | over 2 years ago |
Comment | Post #284952 |
Thank you, applied. (more) |
— | over 2 years ago |
Comment | Post #284952 |
I tried it and it doesn't work. Probably because pointer increments cause the wrong address increment that way. (more) |
— | over 2 years ago |
Comment | Post #284852 |
There's no testcase for Double bogey (more) |
— | over 2 years ago |
Comment | Post #284852 |
@#53196 OK, somehow I missed that. (more) |
— | over 2 years ago |
Comment | Post #284864 |
Please use the sandbox. (more) |
— | over 2 years ago |
Comment | Post #284668 |
Which rules of inference are allowed to be used?
I expect modus ponens is one of them. Also, given that you don't give any axioms for $\leftrightarrow$, you'll need to allow some rules of inference for that as well.
(more) |
— | over 2 years ago |
Comment | Post #284852 |
What about scores beyond par −3 (other than hole in one)? For example, what should the program output for `6 2`? BTW, technically, −3 below par would be 3 above par. (more) |
— | over 2 years ago |
Comment | Post #284777 |
Thanks. You didn't address the leading/trailing whitespace, though. (more) |
— | over 2 years ago |
Comment | Post #284777 |
Does the code have to handle leading zeros (say, `"010.000.007.023"`)? What about leading/trailing spaces (say, `" 127.0.0.1 "`)? Is the string guaranteed to be a valid IPv4 address? Will the IPv4 address always be given in point form, or does the code also need to handle the integer form (e.g. `"16... (more) |
— | over 2 years ago |
Comment | Post #284572 |
The title is misleading: That's not what “solving a crossword” means. Rather, this is a [word search.](https://en.wikipedia.org/wiki/Word_search) (more) |
— | over 2 years ago |
Comment | Post #284501 |
You're right. Thank you for catching this. I'll update. (more) |
— | over 2 years ago |
Comment | Post #284522 |
Nice. I actually started with lambda and list comprehension, but got stuck at the fact that this doesn't allow to handle exceptions, and didn't see that you could pre-check that cheaply. (more) |
— | over 2 years ago |
Comment | Post #284520 |
I'm not sure the conditions allow reordering the input values that way. Maybe Mark Giraffe can clarify. (more) |
— | over 2 years ago |
Comment | Post #284407 |
Shouldn't the test case `2 2 4` also include `^` in the output?
Also, you might add the test case `0 0 0` (giving `+ - *`). (more) |
— | over 2 years ago |
Comment | Post #284428 |
Found yet another improvement: `(2*l==f and N%2)or 2*l>f` is equivalent to `2*l+N%2>f`.
[Try it online!](https://tio.run/##lZTfi5tAEMefs3/FEuixq17R9UeiOYWDplAooXCPx3Hkx9oE7Bp0fSghf3vq7mrQDD7Uh8Hx48w48x33/FceS@Hfbgee4y0RNOEpEVkW0a@7k/wsuPgtj4Su8pRZFl8VqXgi@bNHVxv9GqdPvrequGwqQQi322e@R@nLS0jtjU2YVdi... (more) |
— | over 2 years ago |
Comment | Post #284428 |
I just noticed that the logic for `M` in the return statement now was equivalent to just adding `M`. After that, only one use of `M` remained, allowing elimination of the variable by inserting the expression directly.
[Try it online!](https://tio.run/##lZRLi6NAEMfP6U/RBHboNplF20eiGYWBzcLCEhbmOAxDH... (more) |
— | over 2 years ago |
Comment | Post #284428 |
I just found the function `bit_length` which gives the functionality of the loop, and thus allows to make the encoding function a one-liner, too.
[Try it online!](https://tio.run/##lZRLa@MwEMfP0acQgRbJSRdbfiR2KkNhs7CwCQs9llLykDcBrxxs@bBk89lTPexgR/jQHAZPfp4ZzfzHOv0Th4L71@ueZXCDOE4YRTxNI/xtexQfOeN/x... (more) |
— | over 2 years ago |
Comment | Post #284428 |
The last `if` in `a(n)` can also replaced with logic/arithmetic/bitwise operations, allowing subsequent elimination of `E` and getting rid of a newline/indent.
[Try it online!](https://tio.run/##lZTbitswEIavracQgS6S7QVbPiR2VoaFplBoQmEvl6UksUwCrhx8oJQ0z57VwQl2hC/qi8GTzzOjmX@i09/2UPHges1ZAbeI4xRYjHr... (more) |
— | over 2 years ago |
Comment | Post #284428 |
I just noticed that the early return is not necessary if a small adjustment is done to the initialisation of `E`, saving quite a few bytes again.
[Try it online!](https://tio.run/##lZTbitswEIavracQgS6SkwVbPiS2V4aFulBoQmEvl6XkIBODKwcfKCXNs2d1cIId4YvmYvDk88xo5h/r9Lc9Vty7Xg8sh1vEcQwsRh1g/TkWJYM8pcS2m... (more) |
— | over 2 years ago |
Comment | Post #284428 |
The if/else in `b(r)` can be replaced by `e=E-(E>0);m=M+32*(E>0)`. After that replacement, M can be inserted in place, and so can `m` and `e`.
[Try it online!](https://tio.run/##lZTbitswEIavracQgV0kJwu2fEjsRIaFulBoQmEvl2XJQSYBVw4@UEqaZ8/qYAc7whfNxeDJ55l/RjPW@W99LLh3ux1YBreI4xhYpwzylUfiktVNySEHFqM... (more) |
— | over 2 years ago |
Comment | Post #284391 |
Exactly. I absolutely intended to have thin spaces (LaTeX `\,`) here. I strongly prefer that to commas as thousands separators.
Also, LaTeX inserts a small space after each comma, making it into a list of three numbers instead of one number with commas as thousands separators. Clearly, a list of t... (more) |
— | over 2 years ago |
Comment | Post #284001 |
You can save even more bytes by shortening the colours to the uniquely identifying prefix (also, since my previous suggestion only resulted in a single line, the newline was unnecessary).
[Try it online!](https://tio.run/##dVC7bsMwDNzzFYQnGyi6dAuQLwkyyAptM6FFgfID7s@7olK4QIBOpE7H4x3jNg0SvvbdXSpF2KB... (more) |
— | over 2 years ago |
Comment | Post #284001 |
By replacing the loops with list comprehension, you can save quite a few characters.
[Try it online!](https://tio.run/##dZLBbsMgDIbP61NYOSXStMtuk/okVQ@EOg0dAeSEVtnLZ7@h66ZKu2ADtvH/mbQuYwzv22b2jfCJVvY@3ugszIF6ibdAszXieaHeG/tJ0Y7ClNjYkST3K0XvrkxXFzVmMEjwDpF0jv5Edow2erMwTSYjzAqbCaub5ojKzl9ZSOLMZL4y6n... (more) |
— | over 2 years ago |
Comment | Post #284428 |
The condition of the if/else converts to 1 if true and 0 if false. That's exactly the difference between the two assignments.
Furthermore, you can omit the `==1` from `N%2==1`.
[Try it online!](https://tio.run/##lZTbitswEIavracQgS6SkwVbPiR2IsNCXSg0obCXy7LkIJOAIwcfKCXNs6c62Isd4YvNxeDJ55l/RjPW5W9... (more) |
— | over 2 years ago |
Comment | Post #284396 |
Since after removing the "teen" and "ty" there is some repetition in the string, you can save even more characters by putting that into a separate string and interpolating it.
[Try it online!](https://tio.run/##XZLdbqMwEIWvk6cYjVQJQ3ZrSH82UPMiVS4iMhRL1ET2pHW36rOnY1Ju6gt7/OmcmWPB6YOHyW0vlyP10GdR1et... (more) |
— | over 2 years ago |