Ad
  • Custom User Avatar

    no direct link to trainers, please. => please edit your message

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar
  • Default User Avatar

    Added random tests

  • Default User Avatar

    Function name changed to "can_build"

  • Default User Avatar

    "For the purpose of this exercise," has now been appended to the beginning.

  • Custom User Avatar

    Needs random tests.

  • Custom User Avatar

    Please fix function name:

    warning: function `canBuild` should have a snake case name
     --> src/lib.rs:1:4
      |
    1 | fn canBuild(hand: Vec<&str>, p2_hand: Vec<&str>, p3_hand: Vec<&str>, target: &str) -> bool {
      |    ^^^^^^^^ help: convert the identifier to snake case: `can_build`
      |
      = note: `#[warn(non_snake_case)]` on by default
    
  • Custom User Avatar

    Initial code: p2_hand and p3_hand doesn't need to be (and shouldn't be) mut.

  • Custom User Avatar

    One card must be given away for gaining another card.

    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.