7 kyu
Tube strike options calculator
320 of 1,637mcelearr
Loading description...
Fundamentals
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Terrible
Python new test framework should be used (Refer this & this for more detail)
Ruby 3.0 should be enabled (Refer this & this for more detail)
Done for Python.
Done for Ruby, in this fork
This test: calculator(11, 15, 2). How can the bus win in this case? walkTime = 11/5 = 2.2; busTime = 15/8 + 2/5 = 2.275;
"If the walk is going to be over 2 hours, the function should recommend that you take the bus."
I'm having the same problem. I'm printing my variables to my test so I can see what's going on with the math. For some reason, the measurement for walking, which should be 132, is evaluating to 7.19999999 or something along those lines. I think that one of the tests is broken on the back end.
I keep failing test 4:
1 <= 1, which in my code should
return "Walk"
, but for some reason it keeps returning"Bus"
.This comment has been hidden.
One more question. Pretty frequently I get an error (bus sometimes all the tests pass)
So as I understand, in this test case walk distance = 1.1143910125511627, bus distance = 5.0e-324, distance to the bus = 5.0e-324. Why the correct answer is a Walk in this case? Or is it some test problem?
The answer you seek can be found in the second last sentence of the description ;) How many minutes is the walk in your test case?
1.1 (km) / 5 (km/h) = 0.22 (h), 0.22 (h) ~ 13 mins. Do I misunderstand anything?
Well spotted. There was a small error with the Haskell tests. Please try it now.
Yeap! Now passes every time =)
Can't get right the 2nd test case:
(4, 5, 1, Walk, "Come on, you can walk this!")
Can't understand: walking takes 4/5 = 0.8 hour, while driving on bus takes (5+1)/8 = 0.75 hour. So the bus is faster. Why the answer is Walk? Thanks for the interesting kata by the way =)Here's a hint: When walking to and from the bus stop, what speed are you travelling?
Thanks! My bad =)
Please fix ruby description of predefined speed variables: these are neither
as described, nor
as syntax lets one think, but
And, as Insti wrote, the solution checking code is wrong: testing the minimum time without knowning if it is walk or bus time is flawed, check with (14.67, 0.2, 0.37) for example.
Updated ruby description and solution to fix this.
All fixed, sorry the the troubles, but the template code anyway explained that you had to use
$walk
and$bus
in Ruby case.My fault, I delete the comment line very quickly upon starting a new kata... Sorry. Thanks!
No problem and on the contrary I really appreciate who can admit his/her fault, plus many thanks for your kind feed :)
Nice theme, man! I like it! :)
Kata approved and translated, as you might have noticed :)
I certainly did. My first approved kata. Thanks a lot!
Oh, really? Then let's rejoice for the first of a long series :)
This comment has been hidden.
Well spotted. I have updated the ruby solution so that only walking time is taken into account in this case.
Oh, ok: I missed that part, as the description led me to think that you had to walk if whatever time was less than 10 mins.
Thanks for the heads up :)
Please add at least one example. I completely missed that I don't run with 8km/h to the bus station (which you probably do if you see the bus coming). Other than that, nice kata and tests.
I have added a little example diagram to the description to make sure this is clear.
I'll add it to your Haskell translation as well.
The only issue I ran into was how to know if the bus will drop you off in the middle of nowhere, I spent a long time trying to figure that part out. But once I omitted my logic for it, all the test cases pased. Can you take a look at that.
Hi kenku102, that test case (test#4) will only pass if the solution accounts for the walking that you would have to do before you get on the bus and after you get on the bus. If the solution doesn't account for this walking, the test will fail.
Can you please post your solution as a spoiler comment so I can have a look at it?
This comment has been hidden.
What I was saying was, there is a test case that states the bus will drop you off in the middle of no where, and if it does then you should walk. But you never specifiy how to determine if you're in the middle of no where. It may just be that the test case needs to be reworded.
Hi kenku102, I found what the issue was. The pre-loaded values for walk and run were integers instead of floats, that's why your solution was failing at that test.
I have updated so it should work now! :)
Perfect, ready to come out of beta :)
This comment has been hidden.
This comment has been hidden.
This has been addressed so I'm going to mark it as solved.