Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • 6376602?v=3

    Ok, it was indeed a bit trickier than it seemed on first glance :)

  • 32236948?v=4

    expected:<[An intense fight]> but was:<[You've been defeated]> // My warrior shouldn't be able to fight enemy that is more than 5 levels ahead

    wrong: read the description again, it's trickier than you think.

    Closing because I don't think there is an issue, but if you find what you currently forget and still have troubles with the tests, please post all the information about your current warrior instance, since its creation. Otherwise it's impossible to know if there is an issue or not.

  • 6376602?v=3

    This comment is hidden because it contains spoiler information about the solution

  • 32236948?v=4

    nope. Sounds like the JS version is flawed (see opened issue below)

  • Profile pic

    Is this supposed to happen?
    Your warrior should now be LV 3 - Expected: 4, instead got: 3
    Because if my warrior should be level 3, then it shouldn't have to be level 4 right?

  • Profile pic

    Hi!
    Sorry, in the previous message I incorrectly answered.
    As it turned out, I had a problem with that too.

    There:
    "Training will accept an array of three elements (except in java where you'll get 3 separated arguments): the description, the experience points your warrior earns, and the minimum level requirement."

    In actuality, the NUMBER which is the last element of the array is the MINIMUM LEVEL.

    That is, the LEVEL of YOUR WARRIOR must be greater than or equal to THIS NUMBER - the minimum level (the last element of the array).

  • Profile pic

    As I understood requirement minimum level written in this part of

    'However, if your warrior is at least one rank lower than your enemy, and at least 5 levels lower, your warrior cannot fight against an enemy that strong and must instead return "You've been defeated"'

  • Profile pic

    If anyone has trouble understanding the minimum level for the "training" method, the minimum level is the NUMBER - the last element of the array. that is passed to the "training" method.

    That is, the LEVEL of YOUR WARRIOR must be greater than or equal to THIS NUMBER - the minimum level (the last element of the array).

  • Profile pic

    Hey, thank you for your reply, I first made Integer everything, than after (long, long) exception try Long and asked for help, than I realize that as you've said if I make everything primitive int that it would work. Yes as you've said int worked. thank you.

  • 5911945?v=3

    Can you clarify the minimum level requirement?

    "Training will accept an array of three elements (except in java where you'll get 3 separated arguments): the description, the experience points your warrior earns, and the minimum level requirement.
    If the warrior's level meets the minimum level requirement, the warrior will receive the experience points from it and store the description of the training. It should end up returning that description as well.
    If the warrior's level does not meet the minimum level requirement, the warrior doesn not receive the experience points and description and instead returns "Not strong enough", without any archiving of the result."

    How should I understand the minimum expected level requirement?

  • 32236948?v=4

    ah no, it's actually written in the description already x)

    // Note: all numeric values are integers.

    edit: I got the reason why you're passing the fixed tests but not the random ones: the compiler is casting automatically constant, hardcoded values to long in the assertions, but when you hit the random tests, it cannot do that anymore since the expected value is explicitly defined as an int in my solution.

  • 32236948?v=4

    Hmmm... :/

    I didn't expect that someone would try with longs, actually. All of those should be ints. I'll modify the description to make it clearer (tho, it's weird that you can pass the sample tests but not the full test suite... :o )

    edit: no they aren't wrong, it's just a problem with your signatures.

  • Profile pic

    I believe that test cases has written wrong
    because
    assertEquals(Long.valueOf(1), tom.level());
    assertEquals(Long.valueOf(100), tom.experience());
    this works, but
    originally this was
    assertEquals(1, tom.level());
    assertEquals(100, tom.experience());

  • Profile pic

    Time: 2156ms Errors: 1 Exit Code: 1
    STDERR:
    ./src/test/java/SolutionTest.java:16: error: reference to assertEquals is ambiguous
    assertEquals(1, tom.level());
    ^
    both method assertEquals(long,long) in Assert and method assertEquals(Object,Object) in Assert match
    ./src/test/java/SolutionTest.java:17: error: reference to assertEquals is ambiguous
    assertEquals(100, tom.experience());
    ^

  • 32236948?v=4

    What's the complete assertion message?

    If I should bet without that message, I'd say that's a problem of signature of one of your methods. Note that there aren't any long neither in the reference solution nor in the tests themselves, that's why I'm thinking about a signature problem.

  • Loading more items...