Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
C++ Translation. Based heavily on the current Python translation since it's the one that has random tests.
Your solution is easily viewable by clicking "View Solution" under your comment, so there is no need to share it in discourse. But if you really want to, be sure to click the spoiler checkbox before posting ^^
Abt the Description: Sorting should not be encouraged as the only way to do this (so "must" is too strong here) and the use of "return" here is confusing because you shouldn't be returning the first value as-is
.
Good place to end this discussion. Not a good look on the homepage
C++ Translation.
Approved by someone (can you resolve the suggestion?)
This one LGTM! Tried to approve but apparently if the author is active you have to wait a week to approve. If nobody raises any further issues in the discourse (incl. the author themself), I'll approve it in a week's time
Please feel free to refer to the guidelines.
The Kata is enjoyable, but the first part of the description has run-on sentences that make it hard to read. Consider changing it to something like:
Also, place
##
to the left of bothDescription
andTask
in the description markdown (i.e.,## Task
and## Description
).This is with regards to the description. The tests themselves are very underbaked and you should've at least added random tests before publishing because this might reflect on the Kata rating (it shouldn't but it does)
Please give these guidelines a read. Particularly, try to look at this example as a good idea of how the tests should be formatted: try to avoid using
preloaded
, as the guidelines state, and instead ofstd::cout
, supply anExtraMessage
argument toAssert::That
. Also theif (r > INT_MAX)
branch seems redundant to me since the maximum value generated by your tests,(INT_MAX / 1024) + 200000 * 1000
is still less thanINT_MAX
. Make sure every code snippet begins with any and all headers used in that snippetAll is good now! I just realized I goofed up when I told you to put
no_of_staff
outside. It's meant to be different each time, right? Just put it back in and I'll approve. Sorry, it's totally my badLooks very good and almost ready to approve. Just correct
< 80
in your reference solution and submission solution to<= 80
and take the engines, distributions,places
,base
,no_of_staff
out of theget_random_staff
function and instead just paste them directly above the function. Recreating them within every call is unnecessary and suboptimal. This might mean you may have to use braces instead of parentheses (so C++ doesn't parse them as function declarations). Also, move theusing
type alias into the private section too, so your type aliases are invisible to the user. Other than this, I have no comments. Looks good! Just rearrange your code into:In the fixed tests, just define the type alias inside the
It
. Try to reduce the scope of your aliases as much as possible.I don't see any of the changes. Are you sure you've clicked publish? Also about where to put functions,
Describe
is just a macro and it's a struct behind the scenes. You can have aprivate
section within it. It's also a good place to put your reference solution too (more info here). Just do this:Good job! I have a few suggestions:
std::size_t
for the distributions, butno_of_staff
andq
andl
(the nested loop variables) should also bestd::size_t
. Intermixing integer types causes the tests to generate a warning in the log.boredom
andMyboredom
are inconsistent with each other style-wise. Same withBAS
,no_of_staff
, etc. You seem to lean most towards snake case, so maybe turn most things into snake case.#include <fmt/ranges.h>
and use the below template for your assertions. This might mean you have to store thestd::map
s in the fixed tests into variables so you can reference them to generate feedback messages:Loading more items...