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.
Yeah, I went ahead and refactored the missing logic to complete this kata, thanks!
The tests aren't wrong, your code is incorrect. You aren't using the values of the races at all in your code, that's why it's not working. This isn't a simple "sum up the numbers in each string and see which one is bigger" type problem. Each number in each input represents the number of a certain race or class for that side.
For example, if your
good
input is1 2 3 4 5 6
, then the good side has 1 hobbit, 2 men, 3 elves, 4 dwarfs, 5 eagles, and 6 wizards. Each one of those things has a different "worth". You can see their worths in the description. 1 wizard has the same amount of "worth" as 10 hobbits, for example.Did you read the description and just think "Wow, they're really going on about hobbits and orcs and stuff and this has nothing to do with the task"?
I certainly need help with this Kata. There are several tests that are not working properly, such as one where it should be a tie but instead the test is expecting Evil to win. My code works with the examples on the kata description but when it comes to the attempts, the thing simply fail: Is there a way to fix the tests, please?
1 1 1 1 1 1
1 1 1 1 1 1
Test Failed
Expected string length 48 but was 45. Strings differ at index 15.
Expected: "Battle Result: Evil eradicates all trace of Good"
But was: "Battle Result: No victor on this battle field"
--------------------------^
Log
0 0 0 0 0 10
1 1 1 1 1 1
0 1 0 0 0 0
Test Failed
Expected string length 38 but was 45. Strings differ at index 15.
Expected: "Battle Result: Good triumphs over Evil"
But was: "Battle Result: No victor on this battle field"
--------------------------^
Completed in 1.6080ms
ShouldBeATie
Log
1 0 0 0 0 0
0 0 0 0 0 0
1 1 1 1 1 1
1 0 0 0 0 0
0 1 0 0 0 0
0 1 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
1 0 0 0 1 0
Test Failed
Expected string length 45 but was 38. Strings differ at index 15.
Expected: "Battle Result: No victor on this battle field"
But was: "Battle Result: Good triumphs over Evil"
are u using python ?
Found a problem myself... For every iteration of the loop strlen(str1) is computed, which wastes time. I computed both strlen(str1) and strlen(str2) before the loop to fix the issue and the algorithm works faster and I passed the performance test. Very annoyed by this issue - spent hours trying to figure it out ðŸ˜
Thanks, I am going to check it out!
potentially helpful reading:
This comment is hidden because it contains spoiler information about the solution
I have the exact same issue
Presumably you're not running the failing tests. Find out what failed and do the same thing locally.
Hye colleagues:
This thing must have something wrong in the test asserts, I have tried my code on my Visual Studio Code, then in my IDLE as well and it went just fine. Then I tested it here and it gives me errors each time I try to test it out, any inputs, comment, somebody help!