6 kyu
We are the Robots d[(0)(0)]b
99 of 316user8476848
Loading description...
Algorithms
Data Structures
Regular Expressions
Puzzles
Strings
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.
Description says that legs are "abcdefghijklmnopqrstuvwxyz", when they can also be in the upper case.
Why is it 3 automatik and 0 mechanik if this 'm><0(;0[;a' corresponds to the given conditions? a = ["d*(0)(0)}b We're functioning d>[0;;0&&f automatik D[(0)(0)]b", 'and m><0(;0[;a we dancing are Mechanic']; assert.deepEqual(countRobots(a), ["3 robots functioning automatik", "0 robots dancing mechanik"]);
Mechanic
!==mechanik
, the robots are neither mechanik nor automatik so they do not countTests in Crystal && Ruby violate this criteria-->
Case insensitve count of robots in string with "automatik" or "mechanik"
Neat kata! This certainly makes learning regex much more interesting!!
The initial solution for ruby and crystal are wrong
To me it seems the initial tests are the only ones that are correct. All random tests are wrong.
so "automatik" and "mechanic" are case-sensitive in these languages, not in others
reworded the issue
Nice kata ~~ ^^
I'm finding this very difficult to understand, unfortunately. It might be the way it's told in terms of the "story." I just need to know: What is the expected input? What is the expected output? What constitutes a valid robot?
Agreed, to be honest, I've checked the test and don't know why they are not valid, they seem to match the rules. And I'm saying from logical point of view, not regexs
Hi guys,
This is purely pattern matching/finding. Tell you more would unfortunately be spoiling the task.
I agree that the description is not very clear. It took me a little while to make sense of it, but the task is:
You will receive an array of strings. Each string will contain either the word "automatik" or the word "mechanik", though not both. Each string may also contain "robots" represented by the default string "d[(0)(0)]b". The robots may have different appearances, however. The first and last part of the robot (the "legs"), which are "d" and "b" in the default robot, can be also be any other letter of the alphabet, both lowercase or uppercase. The other parts of the "body" of the robot, which are represented by square brackets ("[" and "]") and parentheses ("(" and ")") can be also be represented by any of the following symbols: |};&#[]/><()* . The "eyes", however, are always represented by zeros. You have to count the number of robots that appear in each string with the word "automatik" and the number of robots that appear in strings with the word "mechanik" and return the counts as an array of the form ["n robots functioning automatik", "m robots dancing mechanik"], where n and m represent the respective robot counts.
I hope that clears this up!
Hi
@rollietikes
, even your ownJava
solution fails if there are 2 adjacent robots and no space between them!For example
d[(0)(0)]Bd[(0)(0}]B
The Kata description doesn't disallow this scenario.
Maybe need more test cases?
:-)
With this kata, I began to understand RegEx. Thanks for a fun and challenge.
You are very welcome glad you enjoyed it.
I hate RegEx!! So: Good challenging kata! ;-) Thanks!
Thanks to you for the great C# solution!
Just a small misunderstanding I ran into:
I initially separated a case-insensitive count for Automatik vs case-sensitive count for Mechanik because of the way it was written (doing case-check on the robot's legs!).
Overall thank you, this was a fun exercise :)
Glad you enjoyed it and sorry if my wording sent you down the wrong path...
description is Updated: => "Case insensitve count of robots in string with "automatik" or "mechanik"."<=
Awesome, thank you for the quick help @rollietikes !
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
I believe all tasks are completed.
This comment has been hidden.
I have no clue. I can't find any either.
It may just be CodeWars acting strangely (again).
Ok thanks for checking...
In js one example test case is wrong. The third one from the bottom expects 3 automatik 3 mechanik but it should be 2 - 3. Final tests are fine :)
I will fix that right now thank you!
Done thanks again! Awesome solution BTW...
Np thank you too for a nice kata.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
d*(0)(0)}b
Thanks Kazk! I changed the description and also added to the random generator as well.
updated!
Hi,
You could make the identification of the robots a bit harder/clearer, maybe. It would be interesting to have less regexp allowed to work. Or not... ;-)
for example, tests with der0)(0))b wich is not a robot, and so on.
This comment has been hidden.
This comment has been hidden.
ahh ok I see what you are saying. See the new updated description where I explain what parts are legs and body. Thanks again for the feedback and help.
This comment has been hidden.
ok ! :)
Glad to see you "upgraded" the robot's chain supply ! ;) (I just discovered I have some obsolete solutions for three of your katas :) )
Nice...sorry forgot to notify you on this thread. Cool solution...
it was rather unclear with pattern =)
This comment has been hidden.
aw) if it was a point to dive deeper in test cases, that's ok. But it would be great to know about it from description, i think.
Hi Joz, I went ahead and made a change to just focus on telling the user what the pattern is instead making them guess it. It makes the Kata a little easier which is ok. Let me know if you like the descrption better. :)