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.
__constructor
in pre-filled PHP code should be renamed to__construct
In order to remove the problem with unexpected occurrences of a signal from detecting obstacles, I propose to make the following addition to the story.
Unfortunately, obstacle detection is unreliable and signals are possible even when the door is not moving. In this case, these signals should be ignored.
It would be nice to see this kata available in Python as well as
A Simple Music Encoder
, I hope someone will notice this suggestion. Thanks in advance, guys!I enjoyed the kata, but I feel that it's a bit underspecified what shall happen if there is an obstacle while the door is immobile. And if it cannot happen, it should be mentionned as well.
No random tests in java.
Thanks everybody for the reviews and the feedback.
After fixing the defect reported by Hobovsky, runtime is now fairly predictable.
I have run all visible solutions against the present tests and all run between 7 and 8 seconds, which is aligned with Blind4Basics' recommendation.
Anything else which needs to be improved? Any suggestions for tags?
Hi,
The specs are... not specs. At all. => the description needs to be rewritten.
Cheers
in the description, there is whitespace in the compressed examples e.g.
"0-4/2, 5, 7-5"
even though there are no spaces in the test casesThis comment is hidden because it contains spoiler information about the solution
Please take a look and fix it!
Input: [35, 35, 31, 30, 164, 141, 136, 131, 126, 126, 3, 84, 87, 90, 93, 155, 158, 161, 164, 167, 133, 128, 123, 118, 113, 153, 156, 159, 2, 131, 130, 86, 87, 88, 89, 90, 196, 187, 105, 52, 198, 190]; :
'352,31,30,164,141-131/5,1262,3,84-93/3,155-167/3,133-113/5,153-159/3,2,131,130,86-90,196,187,105,52,198,190' should equal
'35*2,31,30,164,141-126/5,126,3,84-93/3,155-167/3,133-113/5,153-159/3,2,131,130,86-90,196,187,105,52,198,190'
My decision is correct, because by condition:
Input: [37, 40, 43, 46, 49, 136, 133, 130, 127, 72, 3, 117, 121, 44, 178, 13, 15, 17, 19, 20, 21]; :
'37-49/3,136-127/3,72,3,117,121,44,178,13-17/2,19-21' should equal
'37-49/3,136-127/3,72,3,117,121,44,178,13-19/2,20,21'
My decision is correct, because by condition:
I'd suggest obstacle detection should only occur when closing.
If the door is opening it wouldn't matter; in this case if opening and an obstacle occurs it'd start closing and squish a pet. - This sounds like the original problem the company probably wants to solve. ie When an obstacle is detected the door should begin opening if closing. If already opening and an obstacle is detected continue opening.
An additional intersting additonal would be a double press of the button would reverse direction. And further to that a double press after obstacle would ignore any further obstacles until closed.