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.
no direct link to trainers, please. => please edit your message
It looks like this Kata was abandonned, and since I don't know how to contribute to it I made a copy that uses the more idiomatic enums.
https://www.codewars.com/kata/65a45d91fcc06d67a7635305/train/rust
I didn't come up with the idea and don't intend to take credit for it, so if there's a way to apply my changes to this one here, I'd be happy to do so.
It's unfortunate that the inputs are stringified. Rust has such a nice, rich type system, why not use it? Resources are a perfect fit for enums, with variants being tuples with their respective counts for example.
The idea is good, but it could be even spicier if there wasn't simply a 1:1 trading ratio per resource.
That said, my only real "issue" with the kata is that the tests don't have proper assertion messages. Rust's test framework is designed with the assumption that the code author can see tests and thus knows what "right" and "left" refer to. On codewars, this isn't the case, and it needs to be clarified.
Added random tests
Function name changed to "can_build"
"For the purpose of this exercise," has now been appended to the beginning.
Needs random tests.
Please fix function name:
Initial code:
p2_hand
andp3_hand
doesn't need to be (and shouldn't be)mut
.According to Catan rules trades with unbalanced amount of cards are allowed, but each side needs to offer at least 1 card. Are only 1:1 trades allowed? This should be clarified.