Activity for trichoplax
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #288755 |
Post edited: Mark as finalized |
— | over 1 year ago |
Edit | Post #289542 | Initial revision | — | over 1 year ago |
Question | — |
Word suggesting Suggest a word from a word list, given a string. Motivation Imagine typing a word one letter at a time, and seeing a suggested word after each letter is typed. At first the suggested word is simply the first word in the word list that matches, but once a word has been suggested it is assumed that... (more) |
— | over 1 year ago |
Edit | Post #288755 |
Post edited: Clearer example headings |
— | over 1 year ago |
Edit | Post #288755 |
Post edited: Make input section more precise |
— | over 1 year ago |
Edit | Post #288755 |
Post edited: Make example wordings more precise |
— | over 1 year ago |
Edit | Post #288755 |
Post edited: Add description of test case format and quotes around outputs |
— | over 1 year ago |
Edit | Post #288755 |
Post edited: Add test cases |
— | over 1 year ago |
Edit | Post #288755 |
Post edited: Unordered list formatting fix |
— | over 1 year ago |
Edit | Post #288755 |
Post edited: Add edge case to algorithm and add extra examples |
— | over 1 year ago |
Edit | Post #287110 |
Post edited: Link to main Meta discussion |
— | over 1 year ago |
Edit | Post #287207 |
Post edited: Make rule explicitly reference the test cases |
— | over 1 year ago |
Comment | Post #287207 |
I'm sorry for overlooking the other question. I have now edited the challenge to state that a maximum input length of 16 characters must be supported.
This is based on the previously existing rule
> Provided your output is correct for each input, your code is valid
combined with the longest ... (more) |
— | over 1 year ago |
Edit | Post #287207 |
Post edited: Be explicit about maximum input length |
— | over 1 year ago |
Comment | Post #287207 |
In hindsight, it might have been better to make the input a single character, so that there is only one challenge (the conversion), separate from processing a string or other sequence type.
I will bear this in mind when designing future challenges, but I'm going to keep this challenge as it is (re... (more) |
— | over 1 year ago |
Comment | Post #287207 |
Interesting question. I see that as a separate, slightly smaller, challenge. If you write code that works for a single character, then to be a valid answer here it would need to also include the code to call that for each character in the input. (more) |
— | over 1 year ago |
Comment | Post #289226 |
There are a few things to note:
1. This is codegolf.codidact.com for recreational coding. For help with coding errors you can ask at software.codidact.com
1. Python's `#` for comments is interpreted as a heading in a question post. This is why all the comments show as huge text. You can make a co... (more) |
— | over 1 year ago |
Comment | Post #289167 |
I can't see any problem that could be caused by having a random button on a Meta category (Codidact Meta has had one all this time with no complaints...) so personally I'm in favour of just removing the restriction and having a random sort button for every category. (more) |
— | over 1 year ago |
Edit | Post #289164 | Initial revision | — | over 1 year ago |
Question | — |
A random button for ordering Code Golf post lists On most Codidact communities the posts list has a "Random" button among the sorting buttons: The sorting buttons on Codidact Meta - "Activity", "Age", "Score", and "Random" The only exceptions are the Codidact Proposals community, and Code Golf: The sorting buttons on Code Golf - "Activity",... (more) |
— | over 1 year ago |
Comment | Post #289011 |
Still the same length:
```ruby
->i{i.chars.sort_by{"jbdfghklpqyit".index(_1)||13}}
```
Giving up now... (more) |
— | over 1 year ago |
Comment | Post #289011 |
I couldn't find a way to shorten this, just ended up with the same length. You can use `0` instead of `-1` but only if you add an extra character to the string to prevent the index ever being zero, so it costs a byte to save a byte...
```ruby
->i{i.chars.sort_by{"_tibdfghklpqyj".index(_1)||0}}
`... (more) |
— | over 1 year ago |
Edit | Post #287329 |
Post edited: Reword awkward sentence |
— | over 1 year ago |
Edit | Post #288943 |
Post edited: Typo |
— | over 1 year ago |
Comment | Post #288943 |
Ah. I see what I missed now. Thank you.
Would the first sentence be clearer with the "of" replaced by something like "such that"?
Something like this:
> Given a number $n$ as input output the smallest number $k$ such that the modular residues of $k$ by the first $n$ primes is exactly $\\{-1,... (more) |
— | over 1 year ago |
Suggested Edit | Post #288943 |
Suggested edit: Typo (more) |
helpful | over 1 year ago |
Comment | Post #288943 |
To check if I've understood the requirement, does the following match the intent of the challenge?
> Given $n\ge 3$ find the smallest $k$ such that the first $n$ primes all have a multiple in $\\{k-1,k,k+1\\}$. (more) |
— | over 1 year ago |
Comment | Post #288939 |
I try to post a variety of challenges so there are some that take a minute and some that require more thought. As a result I have some with no answers yet... (more) |
— | over 1 year ago |
Comment | Post #288939 |
It was already clear, just didn't want you getting a downvote from someone who stopped reading before the end of the sentence. I'm probably being overcautious (more) |
— | over 1 year ago |
Comment | Post #288939 |
Great to see a formula for this (even if it's not yet shorter than brute force). I tried but gave up and went with brute force to generate the test cases (which took a while to run...). (more) |
— | over 1 year ago |
Comment | Post #288939 |
For anyone skim reading this answer, the phrase
> the results for $n \in \left\\{ 3, 4, 5 \right\\}$ aren't exactly zero
does not invalidate this answer. The requirement of being correct to 6 decimal places is (far more than) met. (more) |
— | over 1 year ago |
Comment | Post #288914 |
That's a really intuitive explanation. I don't know APL and I still found the visualisation easy to follow with the sequence of tables. (more) |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Mark as finalized |
— | over 1 year ago |
Edit | Post #288917 | Initial revision | — | over 1 year ago |
Question | — |
Probability of rolling all 6 dice faces The probability of rolling every number from 1 to 6 with $N$ six-sided dice. Input - A positive integer $N$. - Your code must work for inputs up to and including 10, but may crash, error, or give incorrect output for larger inputs. Output - A probability, $0 \le p \le 1$ - This is the proba... (more) |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Remove ambiguity from output section |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Add 10th test case |
— | over 1 year ago |
Comment | Post #288914 |
Even though I've convinced myself they are equivalent, I can't visualise yours, whereas I can understand mine geometrically so it makes sense to me intuitively.
If you want the geometric interpretation of mine, $i^N-(i-1)^N$ is the number of ways of rolling $N$ dice that lead to $i$ being the high... (more) |
— | over 1 year ago |
Comment | Post #288885 |
I generally default to using a numeral but it looked strange immediately after the $N$ so I went with "$N$ six-sided" rather than "$N$ 6-sided". (more) |
— | over 1 year ago |
Comment | Post #288914 |
I was curious so I tried to derive your formula from mine. Managed it by unrolling the sum and then rolling it back up at the end. No idea if this is similar to how you found it.
$$\frac{1}{6^N}\sum_{i=1}^6 i(i^N-(i-1)^N)$$
$$\frac{1}{6^N}\sum_{i=1}^6 i(i)^N-i(i-1)^N$$
$$\frac{1}{6^N}\left(\... (more) |
— | over 1 year ago |
Comment | Post #288914 |
I had to implement this formula and test it for myself because it looks so different from the formula I used to generate the test cases that I couldn't imagine it giving the same result - but it does!
For comparison, here's the formula I used:
$$\frac{1}{6^N}\sum_{i=1}^6 i(i^N-(i-1)^N)$$
Muc... (more) |
— | over 1 year ago |
Comment | Post #288903 |
I usually try to make a reference implementation before posting a challenge, but in this case it only exists in my head (which means it's untested). At some point I'll implement it in real code and post it as an answer. It uses a more generic approach which I'm not sure will be golfy (I just needed t... (more) |
— | over 1 year ago |
Comment | Post #288903 |
Glad your testing was more thorough than mine... I should probably generate the exhaustive list of test cases for testing future entries. (more) |
— | over 1 year ago |
Edit | Post #288502 |
Post edited: Emphasise that label must stay the same when moved |
— | over 1 year ago |
Comment | Post #288903 |
I love the detailed explanation!
I couldn't tell from the explanation whether this would still work with the shapes at different positions in the 4 by 4 input area. I adjusted some of the test cases by translating them down or to the right by adding newlines or spaces and they still work.
I als... (more) |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Change test cases from 6 significant figures to 6 decimal places |
— | over 1 year ago |
Comment | Post #285880 |
I notice that several of the answers show on the leaderboard with their byte count instead of the number of unique characters, which often gives them a significantly higher (worse) score. In many cases this is because the answer heading shows the unique characters and the byte count, and the leaderbo... (more) |
— | over 1 year ago |
Comment | Post #288897 |
I was wondering if someone would take the brute force approach. I didn't want to rule it out so I set the maximum required input low. Even with the closed form solution that I used to generate the test cases, I couldn't go much higher without switching to arbitrary precision numbers. (more) |
— | over 1 year ago |
Edit | Post #288885 |
Post edited: Remove redundant test case bullet point |
— | over 1 year ago |
Edit | Post #288885 |
Post edited: Specify face values of the 6 faces of the dice |
— | over 1 year ago |