4 kyu

Decode the Morse code, advanced

6,364 of 15,474jolaf
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • EddieAtRES Avatar

    One of the test cases in Python is actually incorrect: testAndPrint(decodeMorse(decodeBits('111')), 'E') It can't actually be distinguished from 'T'.

    'TT' cannot be distingueshed from 'I' either. Nor can 'TTT' from 'S', 'TTT' from 'H' nor 'TTTT' from '5'.

    Another test case that would catch out most submissions is 'T T'. This can be distinguished, with any transmission rate.

  • danny-bernier Avatar

    In Go 1.20, one test fails but there doesnt appear to be any difference between the expected and my output. Additionally, my code prints the input text for debugging, and when I copy that input and test manually it passes. Is this an isssue with the kata or am I missing something?

    Long messages handling case fails:

    Expected
        <string>: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
    to equal
        <string>: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
    

    However when tested manually it passes without issue.

    var _ = Describe("DecodeMorse", func() {
      It("Example from description", func() {
        Expect(DecodeMorse(DecodeBits("1110001010101000100000001110111010111000101011100010100011101011101000111010111000000011101010100010111010001110111011100010111011100011101000000010101110100011101110111000111010101110000000101110111011100010101110001110111000101110111010001010100000001110111011100010101011100010001011101000000011100010101010001000000010111010100010111000111011101010001110101110111000000011101010001110111011100011101110100010111010111010111"))).To(Equal("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG"))
      })
    })
    
  • ASM.teleco Avatar

    In Python, sample test has the bits wrong, and not in the same format as announced by either the kata text nor as the tests of the attempt.

  • wkuk Avatar

    Could anyone hint me how to find the transmission rate?

  • 12earnshawjoh Avatar

    The preloaded morse code dictionary (in golang) does not include punctuation used in the test cases.

  • CornSnek Avatar

    Lots of transmission rate edge cases.

  • Ómu Omáu Avatar

    bad tests for python

  • atis Avatar

    Multiple bits per dot handling

    WHY "111" supposed to be "." ? WHY???

    This katas need to be reviewed!

  • alviansyahexza Avatar

    how to convert this "10101..." to "-..-.xxxx" should i split it by 8 cause it is a digit ? or still i miss the rule ? i still dont get it, sorry

  • kalatina Avatar

    This comment has been hidden.

  • chomp Avatar

    My code is not passing the Long messages handling test in TypeScript. expected: 'THE QUICK BROWN FOX JUMPS OVER THE LA…' to equal 'THE QUICK BROWN FOX JUMPS OVER THE LA…'

    This is abbreviated, of course, but when I run the TS file, I receive: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG

    which seems about correct. What am I missing?

  • marvinmel0 Avatar

    Kinda hard, but i got it!

  • MohamedTj Avatar

    "111000111" should be (TT) why (I)

    111= - ;000 = pause between char and char ;111 = -;

    sum is (- -) '-' : 'T'

    or 111 = 1 and 000 =0 it will be

    1 = . ; 0 = pause between Dash or Dot 1 = . ;

    sum is (..) '..' : 'I'

    How can I know his intention?

  • BigSeal Avatar

    Kinda got everything done, but I don't understand how to do a standard string check without lengthening. I'm stumped.

  • retr00h Avatar

    I am having problems with the character 'M' in Basic bits decoding. Assuming that a particular sequence of 1s is a dot as mentioned in the text, I assume that 111 is a ., therefore the time unit is 3, but instead it is not, it is actually 1. If I assume timeUnit = 3 then decodeBits("1110111") == ".0.", which doesn't make sense.

    Doesn't this violate the "if you have trouble discerning if the particular sequence of 1's is a dot or a dash, assume it's a dot"?

  • KodaWarrior Avatar

    This comment has been hidden.

  • dgzargo Avatar

    This comment has been hidden.

  • zbmarius Avatar

    How could a skilled professional can transmit 60 words per minute?

    I barely type at this speed 😂

  • ahmet_popaj Avatar

    Tricky kata, nice to solve, compliments.

  • amirfull Avatar

    111111
    would be :

    E -> '.'
    when unit is 6

    I -> '..'
    when unit is 3

    S -> '...'
    when Unit is 2

    in this case the diffrence not between dot and dash. and all of them would be correct. so which one is the answer?

    I think this a problem. or do I have missed something?

  • eburakova Avatar

    I keep getting T and Gs in "Multiple bits per dot" and "Extra zeroes" tests. What could be wrong with my algorithm?

  • ichi_dev Avatar

    Test for '1111111111110000000000000000000000000000111111111111' to equal 'T T' should be added to the task's tests, existing solutions often fail on it, assuming that '111111111111' is a dot (and it's not the case when it can be both dot and dash)

  • LunaTMT Avatar

    My solution works for everything except 'M'

    if M is: 1110111

    "Dot" – is 1 time unit long. Pause between dots and dashes in a character – is 1 time unit long.

    Why is the pause between the two dots not 000 as the dot is smallest time unit (111)

    .0. Expected: 'M', instead got: ''

  • Sounds_of_the_rain Avatar

    Hi all. Please help someone who has completed the "Decode the Morse code, advanced" kata. How to connect to the Morse code class that is on the server, or how to make your own work?

  • Svetalive Avatar

    This one was tough! And it was worth it! Thank you for coming up with such a nice idea!

  • gustavomm19 Avatar

    Hi guys, could you help me? I managed to translate the binary to morse code with the "hey jude" test, but I don't understand how to determine the unit of time in each sample.

  • gustavomm19 Avatar

    I just dont understand how 111 is equal to . and at the same time 1111111 is also equal to . it doesnt make much sense

  • gustavomm19 Avatar

    Did they disabled the replaceAll method for js?

  • nickwright2010 Avatar

    I have passed every testcase besides in the case where it is expecting "I" and I am returning "E".

    After some investigation it looks like the testcase is being run twice. First, setting bits to "1"; Second, setting bits to "101";

    I seem to be getting the correct answer on the first iteration...

    Here is a picture of a console log at the top of the solution where I am logging bits - https://ibb.co/hBH1RdJ

  • WilliamSmithE Avatar

    I found this one enjoyable for a few reasons:

    1.) Why can't you provide the morse lookup method so I can better understand it? 2.) Why don't you provide all of the test bit strings so I can try to understand them in my own compiler? 3.) Your specifications for error correcting are not clear.

    All of these make this challenge hard and frustrating, not because of the difficulty of the programming involved, but because of the way this challenge was structured and presented.

  • naitsirhc Avatar

    Hello!! I am new on Codewars. How can I view the test cases, so I can see why my code is failing? From already thank you very much

  • VolodPol Avatar

    Hi! I'm a little confused with description. The standard specifies that "Dot" is 1 time unit long, whereas "Dash" - 3 units. I don't understand why the example with 'HEY JUDE' -> 1100110011001100000011000000111111001100111111001111110000000000000011001111110011111100111111000000110011001111110000001111110011001100000011 contains duplicated bits for dots, dashes and pauses. Like in stead of 1010101 for H character, it is 11001100110011. Does this mean that an arbitrary binary code may have a different length for time unit which represents number of bits for dot, dash and pause? Thanks in advance

  • whuzar Avatar

    This comment has been hidden.

  • DennerFernandes Avatar

    This comment has been hidden.

  • b-valiyev Avatar

    I am in love with these Morse katas. Thank you very much for creating it, jolaf!

  • nushae Avatar

    This comment has been hidden.

  • maestroviktorin Avatar

    Indeed, it's a one of the most fairly appreciated katas. It makes you to delve into each word written in Details. Also it's way easier to solve it having the previous one solved.

  • StabiloSGU Avatar

    Spent too much time on the second task. This is amaing, nothing destroys my self esteem like these problems.

  • Firras Avatar

    I passed every test and failed only two, I don't know what is the problem. Got 'I', expected 'M' I got this for two of them one in "basic bits decoding" and the other in "Multiple bits per dot handling".

    If you can help me out I'd be really thankful.

  • Grempington Avatar

    Loved this exercise!

    As a side note, you should probably add a test case that passes only zeroes in. I was able to submit a solution that would result in a division by zero panic in such a case.

  • Madifly Avatar

    Hi! Spent sooo much cool time on this kata. Finally I passed all the tests except 'Long messages handling'.

    "Got 'S5ES', expected 'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.'"

    Can anyone advise how it can be fixed?

  • Quark Fox Avatar

    liked the kata!! liked it better than the 6kyu one, but that was also nice!!

    stared for a while when i saw "11001100........................etc" = HEY JUDE any way Hello Jude

  • mawh Avatar

    Is the "time unit" consistent within a single message?

  • 66  Avatar

    Please review: C++ Fork

  • crazynds Avatar

    What is the error for the follow tests?

    Input: 111
    decode_bits: -
    Got 'T', expected 'E'
    
    111000111
    decode_bits: - -
    Got 'TT', expected 'I'
    

    111 => "Dash" – is 3 time units long.

    If i get only 111 how it can be 'E'?? '-' = T in morse code

    https://prnt.sc/wTwKu6dQgGrJ

    What is the error?

  • smelyj borsh Avatar

    Hi, It will be good to have similar languages support for all parts of this riddle. For example, I've completed part 1 on c++, but do not found c++ among languagues options for part 2.

    Really pitty, that can not continue with that well formatted task here further.

  • ElMasi Avatar

    There's a test case: "1110111" that seems pretty much impossible to translate. I ran it even through a morse translator, makes no sense. Is this expected behaviour?

  • Azuken Avatar

    Hey, Does anyone know how to shorten an array of bits?

  • Enthusi Avatar

    Hello lovely people,

    I believe that there is a possible ambiguity of the problem itself. If the time multiplier is indeed 1: Then "111" has to be "-" and therefore "T". As it does not contain any 0 which would indicate the move to another dot or dash.

    The same goes for "01110". My solution shows this as "-" -> "T". But the test says it should be an "E".

    So, there is a possible problem as a program cannot know, if the "111" comes from a machine that repeats the "1" three times (time factor of 3) and therefore equates to a single "E". OR If it comes from a machine with time factor of 1, therefore the "111" being "-", thus "T".

    Another possibility is that I am wrong and it is easy. :D

    Please, have another possibility in your testing for this. /Cheers!

  • ZufarIs Avatar

    c# Really nobody had a problem with Execution Timed Out (12000 ms)? Average Test execution is about 2500 ms, and Attempt is failing...

  • fstasel Avatar

    There are ambiguities in test cases. For ex: is "111" a 'T' (when time unit = 1) or an 'E' (when time unit = 3)? Since we dont know what the time unit is, both interpretions are possible.

  • UniStart Avatar

    The test case is incomplete. If you transmit only the sequence of 0 and 1 of the letter T, most answers will not work properly

  • TERNION2205 Avatar

    Gotta say calculating the transmission rate was the toughest part of the problem for me! Nice kata!!

  • Lauren-B4 Avatar

    In the case of 101, I'm having trouble understanding why this evaluates to "EE" in testing, when a single time unit of space is considered a pause between dots and dashes in a single character.

    Would this not mean that 101 would be translated to ".." with no spaces, making it "I" instead of "EE"?

    For instance in the Example of HEY JUDE the H is represented as 4 separate dots "11001100110011".

  • hannes888 Avatar

    This comment has been hidden.

  • Styphon Neon Avatar

    For the case 1110000000111
    If we consider the unit to be 3, the sequence of 7 0's will not make sence, which means we can confirm that unit is 1.
    So this bit string should be translated into T T instead of any combination of E's (for this kata only).

    That means, any solution that finds the minimum length of sequences of 0's and 1's as the unit is incorrect.

  • 67E0 Avatar

    I have so far been unable to pass the tests testBasicBitsDecoding and testMultipleBitsPerDotHandling in java, while I pass the other tests.

    But why should 110110001 eveluate to "EE"? There is clearly 3 characters in this String.

    The test also tells me it expects "EE" for, 111111111111001111100011111111000001111111111100111111111000000000111, which makes even less sense.(I tried to log the bits input into the methods by the test.)

    I would appreciate if someone with the authority to do sp double-checked the units tests for java.

  • a11ce Avatar

    This comment has been hidden.

  • rsschool_ac128daa26803562 Avatar

    I'm trying to solve this problem, and I think that I like the letter "E" less and less. I failed 6 tests coz of "Expected: 'E"

    But I like to challenge with this kata, it's so awesome! Thanks for this series!!

  • tarnovsky Avatar

    Seems to be missing C++, not sure if this is intentional or not because both part 1 and part 3 of this series have it.

  • Jazzroman Avatar

    I tried different ways to solve it but still don't understand 111000111 is '..' or '- -' ? Could someone explain one more time please?

  • zalars Avatar

    Two questions:

    1. is it right to copy code from my solution of the previous task ("Decode the Morse code") to 2nd function "decodeMorse(morseCode)"? - nothing about it in this task. First test was passed successfully;
    2. there are 4 errors at the "Attempt"-stage with the same description: "Cannot invoke "String.isEmpty()" because "str" is null" - in testExtraZerosHandling, testBasicBitsDecoding, testLongMessagesHandling and testMultipleBitsPerDotHandling. How to fix it?
  • ileri4s Avatar

    Is anyone here to explain how can we achive

    from 1100110011001100000011000000111111001100111111001111110000000000000011001111110011111100111111000000110011001111110000001111110011001100000011 to HEY JUDE

    I dont understand. According to the these rules shown below.

    "Dot" – is 1 time unit long. "Dash" – is 3 time units long. Pause between dots and dashes in a character – is 1 time unit long. Pause between characters inside a word – is 3 time units long. Pause between words – is 7 time units long.

  • ximki-vinki Avatar

    This comment has been hidden.

  • thomas-vincent Avatar

    I don't get why "10001" should unumbiguously translate to ". ."

    The instructions state " if you have trouble discerning if the particular sequence of 1's is a dot or a dash, assume it's a dot. " But it does not say anything for a troubling sequence of 0.

    Here "000" can be a dot/dash separator with a bitrate of 3 or a letter separator with bitrate of 1 or a faulty word separator.

    I see from the answers that everyone assumes a letter separator...

    Besides, if the bit code does not make sense, it does not seem a good idea to fall back to an arbitrary decoding that would not make sense either. Why guessing? The program should instead gracefully fail IMO.

  • spyhere Avatar

    This comment has been hidden.

  • yfzhe Avatar

    This comment has been hidden.

  • Kastellan Avatar

    Oh my god. It took me so long to realise what the description meant. I thought we were presuming that the time units for all of the dot / dash / sepeartions were uneven and you had to find their lengths given they should be in a size order (dot/dash is made of 1s but a dash will be longer), not that they will stick to the (k * "time unit"). That is so much easier...

  • QueXu Avatar

    completing the kata in ruby and coming up against this error message:

    `block in decodeBits': no implicit conversion of nil into String (TypeError)

    is anyone able to help? thanks

  • burovb Avatar

    Seems like Java in-built dict for transforming morse code to letters has wrong order of keys and values, where they should be interchanged.

  • tttony Avatar

    Thought thare was a C version to play with it since I solved the first one, so I guess I have to wait

  • ElectricZatch Avatar

    Fantastic kata! On to the next one! Thanks :)

  • ahmed the potato Avatar

    ...---...

    Log 1111111 #print(bits) -. #print(morse_code) Got 'N', expected 'E'

    how can 1111111 be "E" = "."

  • Aperonis Avatar

    Hi, on JS, why BigInt is not defined ? I tested in VSCode, and everything worked.

  • tayeb Avatar

    Passed: 1 Failed: 0 Exit Code: 1 Why is that i pass the "submit" with an error but i still pass! KeyError: '1' it signals line 86 even though the code gets executed beyond this line

  • chocomania Avatar

    Great Kata! Word of advice - make sure you're getting the right unit of time :)

  • IDilettant Avatar

    MORSE_CODE = { '.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E', '..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J', '-.-': 'K', '.-..': 'L', '--': 'M', '-.': 'N', '---': 'O', '.--.': 'P', '--.-': 'Q', '.-.': 'R', '...': 'S', '-': 'T', '..-': 'U', '...-': 'V', '.--': 'W', '-..-': 'X', '-.--': 'Y', '--..': 'Z', '.----': '1', '..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6', '--...': '7', '---..': '8', '----.': '9', '-----': '0', '--..--': ', ', '.-.-.-': '.', '..--..': '?', '-..-.': '/', '-....-': '-', '-.--.': '(', '-.--.-': ')', }

  • Synderene Avatar

    if I have '11011' for example, how do I know if it is 2 dots for a word or 2 distinct words ? the first one got '..' or 'I' and the second is '. .'or 'E E' also I have a test case where I return 'I' or '..' instead of 'M' or '--', am i wrong or the test case assume it to be dash rather than dot

  • exxericxx Avatar

    I believe it shouldn't be a thing that 111 is just a "." of 3 time units and "-" not be a valid interpretation becaus it literally is 111, which is the definition of "-". There is a test case when "attempt"-ing that is literally just 111 and I interpreted it as - instead if ".", there's no clue to know it is not a "-". If i am wrong, please explain how should I know when this is the case where the time unit is 3.

  • Evangelinetdy Avatar

    This is a very nice and challenging kata. I love it. Function one should take care of different time unit of each message. For example, in 1110111, the time unit is 1(single 0 in the middle), thus a dash is 3 time units long, which is '111'(or '1'* 3units). Hope this is helpful. And have fun:)

  • MyBraza Avatar

    It would be nice, if it would more explicitly specfiy in the description, that time units may be different Function decodeBits(bits), that should find out the transmission rate of the message

  • ShadowSphynx Avatar

    This comment has been hidden.

  • akiguido Avatar

    Hi, i have a problem, the description says: "The Morse code table is preloaded for you" but it seems that morseCodes is not preloaded. I am trying in Python.

    error: decode += morseCodes(k) NameError: name 'morseCodes' is not defined

  • wayne-keepo Avatar

    This comment has been hidden.

  • chinesestuff Avatar

    This comment has been hidden.

  • BlackW1nd Avatar

    This comment has been hidden.

  • RomanKornev Avatar

    Needs better tests

  • Jayohaychen Avatar

    On python 3.6 one of the tests has me failing because with the input '10001' it's expecting 'I' but getting 'EE'. I'm pretty sure 'EE' is correct in this case bacause, as I understand it, in the case of '10001' the time unit would be one character meaning that the three zeros in the middle signals that you're moving to the next character but still within the same word. 'I' in morse code is '..' and 'EE' is '. .', so with a transmission rate of 1, shouldn't 'I' be '101', not '10001'?

  • jambot3000 Avatar

    On python 3.6, one of the test cases provides wrong input (unless I'm understanding wrong). The input is 01110 - It expects "E". But surely this should be "T", as presumably those 0's are spaces (in which case a 0 is one time unit, so a dot should be "1").If they aren't spaces, and are random, then how are you supposed to interpret this?

    Edit: went through the comments some more and found someone with a similar issue. the description says to Assume it's a dot, if this occurs. "Also if you have trouble discerning if the particular sequence of 1's is a dot or a dash, assume it's a dot"

  • DanGlezCa Avatar

    This comment has been hidden.

  • chrisfrancis27 Avatar

    This one was a beast, really enjoyed it :) I had a solution working for everything except the first "Extra zeroes handling" case. When I fixed that, the second case failed and I realised I was calculating the time unit (transmission rate) incorrectly. Finally fixed that and it all works! Now I'm left looking at a regex that I don't understand even though I only wrote it a few minutes ago. Ahhhh, code.

  • ronanazarias Avatar

    I really don't understand, the Python algorithm that I used in the first part doesn't work here. I tried new approaches, but nothing. The Binary-to-Morse works fine, but the morse-to-string fails every time. Can anyone help me?

  • ubant Avatar

    This comment has been hidden.

  • Moranilt Avatar

    I've spend 10 hours to solving it xD Thank you for this kata. The best one! Don't give up and try to do it by yourself!

  • Praimus Avatar

    Can anyone Help me to understand this?

  • glynester Avatar

    This comment has been hidden.

  • zLuki Avatar

    Really nice kata, sadly no random tests

  • RealKenshiro Avatar

    Thanks to the author.

    Very interesting and instructive Kata!!

  • Stormhunter Avatar

    This comment has been hidden.

  • Nyrico02 Avatar

    System.Collections.Generic.KeyNotFoundException : The given key '····' was not present in the dictionary. I dont understand my codes works perfectly fine in VS (C#)

  • cowardfxn Avatar

    How is the bits input "01110" expected to be "E", while "1110111" expected to be "M" in the test case?

  • doooom Avatar

    Should add more random tests.

  • hashour2098 Avatar

    This comment has been hidden.

  • helix0704 Avatar

    Really enjoyed this kata - I realized after I finished I went way overboard (rate equations, testing variables, dictionary copying), but I really appreciate how much I had to think through for this one. Understanding how to get the user's transmit speed took longer than I like to admit.

  • Katczinsky Avatar

    God I wish programmers could express their thoughts like a human beings

  • tester92 Avatar

    Hello, may I know if there is any C translation for this Kata? Thanks for any kind response.

  • user8251865 Avatar

    In C#: System.Collections.Generic.KeyNotFoundException : The given key '' was not present in the dictionary.

    I assumed that it was just whitespace or something in the output of my functions but apparently not. I have tested it with a Morse Code dictionary offline in Visual Studio, it works flawlessly. I am not sure as to why I am getting this error in the server. Can you give it a look? Thanks.

  • moon_cake Avatar

    hello there! when is gonna be this kata available for c++ wizards like me ?

  • crunchCBS Avatar

    Why would '01110' have a time unit other than 1? '0' is the maximum pause time unit in the test case, which implies pause, dash, pause. If '111' was a dot of 3 time units, then what is '0'? A third of a time unit pause??

  • cutlerheman Avatar

    This is a very tricky Kata. It is a lot of fun to work through, but has also shown me that I still have a lot to learn.

  • addamos91PL Avatar

    Can somebody tell me why when: "console.log(decodeMorse('....'));" i'm getting "E..." should be "H" ?

  • loukas Avatar

    I am trying this Kata in Kotlin but when I run the sample and the test suite, I get the map MorseCode does not reference to anything. Seems to be not loaded / there.

    src/main/kotlin/solution.kt:52:24: error: unresolved reference: MorseCode
                     .map{ MorseCode[it] ?: "" }
                           ^
    
  • stuenofotso@gmail.com Avatar

    Scala translation proposed https://www.codewars.com/kumite/5f46502cf6b339002e564c41?sel=5f46502cf6b339002e564c41 Can someone approve it please ? Or let me know if there are any issues :)

  • EricB10 Avatar

    Based on the description, 111 could be correctly interpreted as E or T. It is an edge case, but since it is one of the tests it should be addressed in the description.

  • tranquility-base Avatar

    Easy problem to fix: the provided starting code has a function decodeMorse(), but shouldn't it be named decode_morse()?

  • IamtheVan Avatar

    One of the tests is '111' and it can be interpreted as both '.' and '-'.

  • bom2013 Avatar

    This comment has been hidden.

  • Engoh Avatar

    i have had over 6hours on this. gosh.. now i have one error it translate 1110111 as T instead of M .. i think am getting the users speed wrong. what can i do?

  • MagnusTroll Avatar

    One thing that caught me off guard with this kata is that I came under the impression that the pauses might not be uniform with the '.'s if done by an unskilled operator. So 111000111 is 'I' (two dots), but 11111100111111 is 'M' (two dashes).

    The thing that is still throwing me off, though, is that 10001 is meant to map to 'EE', so it appears like the test cases allow the pauses to be longer than the dots but not vice versa?

  • nordkind Avatar

    Per se a nice task, however I found a few of the missed tests to be not very well specified beforehand.

    I would like to have a deeper explanation in terms of how you want us to handle the erros that occur because of the Eindeutigkeit of bits like 111000111.

    Or at least deliever some premanufactured tests that make it obvious that these are of concern to you.

    Best regards!

  • Pampushka Avatar

    So, after reading the details of this kata I was unable to understand one thing. For example, I have an input "111". I have no way to distinguish a dot from a dash in this case. What do I do in this situation?

  • Mr-G-ICT Avatar

    How is 111 E? I thought only 11 was a dot? anything more than 11 was a dash?

  • Vectoras Avatar

    This comment has been hidden.

  • andiz Avatar

    Hi guys,

    I have struggled with this kata 2 days for now and I can't understand where I am wrong. I can't understand this thing: we have: 110011001100110000001100000011111111.... let me split this in Morse code 11 = . 00 = nothing 11 = . . . . and so on.. but when I reach the first set of "111111" I can't understand what is supposed to be coded in Morse as something else than : "-.." because we have the first 1 that lets us know that the line is connected, the next 3 of 1 indicate the "-" and the next 2 of 1 indicate 2 points: ... In the converted text there is another sequention that is "-.--" I am really glad for your help

    Thanks, :)

  • aaronburmeister Avatar

    This took me forever to figure out after solving the initial problem. For some reason I didn't think you'd have to account for the skill of the user, despite the kata explicitly mentioning it.

  • iyousifi Avatar

    How can "110110001" be expected to be EE? When the single 0 means the time unit is 1. The two sets of 11 would be neither dot nor dash, so we'll assume the are dots, as instructed.

    Then there is the matter of 000 which would be a space(3 time units long) and a dot. So ".. ." == "IE"

    Please help :)

  • IDIR YACINE Avatar

    When there is a doubt between a sequence of 1's been "." or "-" how do you decide that ? based on what ? The description is kinda unclear at that part

  • Jamim Avatar

    This comment has been hidden.

  • oldasz80 Avatar

    In details you mention unstable coding by human operator, but i don't see any of this in tests. Allmost all soultions assume signals to be integer multipy of given signal norms and unit. Is this what author has on mind ?

  • mzuppichin Avatar

    This comment has been hidden.

  • michal-szulc Avatar

    Hi Guys,

    I'm coding in Java and notice that following string should be considered as "E" (.) "01110", "111", "000000011100000" which is somehow logical becasue I need to handle extra zeros however in this string "000111000101010100010000000" is considered as "THE" so "000111000" in longer string is considered as T (---). Moreover this is also considered as single "E" "1111111". There is a rule if there is a doubt between (.) or (-) then I should choose (.) but in this case it is hard to guess.

  • The Undead Zombie Avatar

    Hi! Could anyone help my query?

    My code translates '111' and '111000111000111' as '.' and '...' respectively, but testing says it's wrong.

    What should be the right translation?

  • nikitaodnorob Avatar

    This comment has been hidden.

  • Mr_D Avatar
    Thanks, and sorry.
    Just so others are aware the sample test still only works for 2.7.6 and 3.4.3.
    3.6.0 still has the same error, although the full test does work.
    Again thanks for your help.
  • Mr_D Avatar
    There seems to be an issue with the test for Python 3.6.
    I edited the code as below, so it returns the correct result without any computation:

    def decodeBits(bits):
        reurn ".... . -.--   .--- ..- -.. ."

    def decodeMorse(morseCode):
        return "HEY JUDE"

    With this code I get still get the error:

    File "main.py", line 7
        print "<pre style='display:inline'>Got '%s', expected '%s'</pre>" % (got, expected)

    If I change the complier to 2.7.6 it does work for the above code, but not for my solution due unknown version 3 commands.
    It would be great to see this working so I can fully test my solution.
    :-)
  • Ertwuo Avatar

    There is problem with test for Python 3.6.0

    File "main.py", line 7
        print "<pre style='display:inline'>Got '%s', expected '%s'</pre>" % (got, expected)
                                                                            ^
    SyntaxError: invalid syntax
    
  • chan2x_M Avatar

    This comment has been hidden.

  • LanPodder Avatar

    This comment has been hidden.

  • choumarin Avatar

    The test extra_zeros_handling seems to expect 01110 => . but it seems like it could perfectly be - as well.

  • FArekkusu Avatar

    The description doesn't include the name of the morse code table for some languages.

  • mirtoto Avatar

    What is dictionary name for Rust?

  • wavecycle Avatar

    I passed the sample test but failed when I attempt. To try and debug I'm printing out the bits to console from decodeBits, and this one has me stumped:

    Bits : 111 1111111 110011

    Error: expected:<[I]> but was:<[E]>

    I am not seeing how that is supposed to be an "I" which translates to ".." (Morse) or an extrapolation of "101" in binary...which is what the last line is but what about the two lines of 1's above that? Thanks

  • DouglasLutz Avatar

    Just like part one, would be nice to have this one in elixir

  • Tarlanc Avatar

    The Python test syntax in main.py uses the 'print ""' expression instead of 'print("")', even if the Kata is solved in Python 3.x. So, it raises a syntax error. Please revise. (If left as is, the kata may only be solved in Python 2.7. Any 3.x specific functions are impossible)

  • lonkaan Avatar

    It would be nice to see MORSE_CODE dictionary on description or in editor so that I can work on my local machine. Even after finishing the first kata of the series, I couldnt find it and was too lazy to search on google.

  • evgeni-nabokov Avatar

    Can anybody exlain the example, how did we get 1100... from dots and dashes?

  • MelGrubb Avatar

    This comment has been hidden.

  • miaachan Avatar

    Have spent some time to figure out what is going on actually. I would rate this as a very interesting kata! Gotta try the next one.

  • FArekkusu Avatar

    No random tests.

  • KataSideKick Avatar

    C# translation added~

  • atzimler Avatar

    Hi, If there is only one character, how do you logically decide that it is a short or long one? You have nothing to compare it to. 111 can be a . with 3 unit transmission rate, or a - with one unit transmission rate. To be clear, this is not a coding question, this seems to be missing from the text of the exercise. Also, how do you actually do it?

  • zhiburt Avatar

    Jaw-dropping cata!) It was extremely interesting.

  • AverchenkoAA Avatar

    Basic bits decoding Expected : E to equal : I But I saw there is "1" incoming. It decodes as ".". So "E" is right.

  • Klopma Avatar

    Description says that ···· · −·−− ·−−− ··− −·· · is HEY JUDE but as seen in the previous kata, there should be 3 spaces between Y and J, am I right?

  • Ξlchin Avatar

    What is js MorseCode convert dictionary name ?

  • FArekkusu Avatar

    Function names should be in snake_case in Python.

  • FArekkusu Avatar

    Python 3 should be enabled.

  • akvptp Avatar

    Kotlin translation, would someone mind reviewing this.

  • PUPITO Avatar

    This comment has been hidden.

  • Shaddy Avatar

    This was a bit hard to understand at somepoint (more because of my fault than the exercise itself), but really amazing to solve. Would be great if we can solve the next version in Rust.

    Thanks for the Kata!

  • adamhosman Avatar

    A Python dictionary I made for running my own tests:

    Python morse = (".---- ..--- ...-- ....- ..... -.... --... ---.. ----. ----- " ".- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- " ".--. --.- .-. ... - ..- ...- .-- -..- -.-- --..").split(' ') abc = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ' MORSE_CODE = dict(zip(morse, abc))

  • billow Avatar

    when bits = '1110000000111'. It's time-unit should be 1. but too many solution's is 3.

  • johnbarleycorn Avatar

    Hello,

    Java version seems to be broken. Kata description warns "Caution: This kata does not currently have any known supported versions for Java. It may not be completable due to dependencies on out-dated libraries/language versions."

    Preloaded MorseCode.get returns null for any input.

    Please fix.

  • hofmanndavid Avatar

    morse E = . morse T = - input: 111, time-unit = 3 output shoud be T, but I get

    Expected: is "E" but: was "T"

    Why is that?

  • hlais Avatar

    Sorry but i would really like to do this in C#, how can I go about this? or can you point me towards the rules?

  • Vigilait Avatar

    This comment has been hidden.

  • CFi6 Avatar

    Please include in the instructions that if you cannot determine beteween a dit and a dah it's a dit. I got stuck on that for a while.

    Ex: 111 should be . not - 1 should be .

  • kosciusz Avatar

    Please review Haskell translation.

  • kasparovnutter Avatar

    This comment has been hidden.

  • metalim Avatar
  • colorfulsky Avatar

    I wrote the functions and passed the samples test,but failed the final.I tried to debug them in chrome,but nothing.Oh,I feel puzzle about it,pasting the origin codes here may be not suitable.How can I get some helps?

  • RiccardoMaltese Avatar

    I keep passing all the tests in Python except for one on "Multiple bits per dot handling" and I can't figure out what on Earth is going on, since all other tests in the same section are completely fine. Anyone has any idea?

    Time: 123ms Passed: 18 Failed: 1 Test Results: Multiple bits per dot handling Log Got '', expected 'EE' Value is not what was expected

  • nixlim Avatar

    Really enjoyed this one, thank you

  • CyanGlory Avatar

    Is this 01110 code should be translate for - or . ?

    I think this is a -, but the test is .

    result is E not a T, I get.

  • ZxBing0066 Avatar

    This comment has been hidden.

  • user17088 Avatar

    This comment has been hidden.

  • user17088 Avatar

    Is there any way to see the input data for the second more complex set of tests? My code passes all but three tests. I set up my own dictionary using a JS object and things seem to work.

    Basic bits decoding Expected: 'EE', instead got: 'I' Expected: 'M', instead got: 'I'

    Multiple bits per dot handling Expected: 'M', instead got: 'I'

    I do like this Kata.

  • carlosvr10 Avatar

    I have a question.

    For the example "HEY JUDE", the method decodeBits() should return "···· · −·−− ·−−− ··− −·· ·"?

    If I put public static String decodeBits(String bits) { return "...."; } and then run the test, the message is "Expected: is "HEY JUDE" but: was "H""

    If I put public static String decodeBits(String bits) { return "···· · −·−− ·−−− ··− −·· ·"; } and then run the test, the message is "Expected: is "HEY JUDE" but: was "null""

    But i see that the tests call both MorseCodeDecoder.decodeMorse AND MorseCodeDecoder.decodeBits

    Thanks.

  • bigtoe416 Avatar

    Replace description's "amature" with "amateur"

  • isqua Avatar

    Hello, jolaf! Very nice kata. I translated it into go: see my kumite. Hope you’ll aprove it. If something is wrong with my translations, please notice me.

  • BrunoM24 Avatar

    At first attempt it pass on the sample test, when I do the attemp it pass on 7 test and fail on 8. But I cant or I dont know how to see the bits sequence on the 8 test that fail to try understend why is failing...

  • ethaning Avatar

    completing the kata in ruby and coming up against this error message:

    `block in decodeBits': no implicit conversion of nil into String (TypeError)

    is anyone able to help? thanks

  • Ze-Marcos Avatar

    Do you have to solve a kata before you make a translation ?

  • ZENNON Avatar

    Would be good to have a C# version of this Kata (since the first and last one in the series already do)

  • ReneHabermann Avatar

    This comment has been hidden.

  • friedl@otto.zone Avatar

    This comment has been hidden.

  • n0ttake2 Avatar

    This comment has been hidden.

  • edosudoku Avatar

    Why isn't this Kata in C#? The previous one was.

  • uriel_sb Avatar

    Is this kata completable on Java? The example test always fails for me, even when I hard coded the wright answer (return "HEY JUDE").

    Expected: is "HEY JUDE" but: was null

  • JADA Avatar

    Got "I", expected "M": Does one of the tests need revision?

    Reasoning: If "I" is ".." and "M" is "--", the instructions to assume that an unknown input is a "dot" might be misleading for this test.

    Thanks for the help and the great Kata.

  • BondoS Avatar

    This comment has been hidden.

  • 10ca1h0st Avatar

    Do '1' always represent dot or dash?

  • 10ca1h0st Avatar

    who can tell me why there are an odd number of "1" in bits ? what's the meaning?

  • BondoS Avatar

    On JavaScript my code passes example test but, when I try to run the full suit test, I receive this message. "Failed to process output. It is possible that too much data was written to STDOUT." Help Please

  • henryhamon Avatar

    This comment has been hidden.

  • ArtOfCode Avatar

    In the Python version, the test cases for "Extra zeros handling" are incorrect.

    The test submits 01110 as bits. With extra zeros stripped, this is 111. The sample rate here can only be one per dot. Hence, this message is three time units long, and the signal is HIGH for all three time units. This represents a dash. According to the Morse code standard, a dash is T: see https://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/International_Morse_Code.svg/450px-International_Morse_Code.svg.png. These tests expect E, which is instead a dot.

    The same issue applies to the other test case (bits=000000011100000): Got T, expected E, but T is correct.

  • syahrulm Avatar

    if the input 01110 and 0 is translate as "", i think 111 should translate as "-", why you it translate as "."?

  • theZaki Avatar

    I don't get why "111" is considered as an 'E', can enyone enlighten me please.