Morse Code (translate text to and from morse code)
Description:
Morse Code was a way early telecommunication method. It was a simple translation of alpha numeric characters to a series of short and long signals often described as dot and dashes (. -). This kata will have you take text and transform it to a series of dots and dashes, as well as taking a series of dots and dashes into text. Solving this kata can expose you to the various functions in each language such as:
Strings,Arrays,Loops,Regular Expressions,Splitting/Joining/Replacing Strings.
Below are the characters and their associated morse code:
Please note that morse code does not have separate codes for upper and lower case. For this challenge you should assume all text to be in lower case.
To clarify both "(" and ")" are the same sequence in morse code "-.--.-". when translating back from morse code to text either will be acceptable.
Arrays/Lists/Hashes/Objects/Sequences for both "morse code -> character" and "character -> morse" code are preloaded and may be accessed as such:
textToMorse["a"]
morseToText[".-"]
In javascript objects (one way javascript handles associative arrays) are created and used like this:
var obj = {};
obj["a"] = 0;
return obj["a"] -> 0;
or in the case of an actual array
myarray = new Array("a","b","c");
return myarray[0]; -> "a"
Similar Kata:
Stats:
Created | Nov 20, 2017 |
Warriors Trained | 454 |
Total Skips | 26 |
Total Code Submissions | 849 |
Total Times Completed | 61 |
JavaScript Completions | 18 |
PHP Completions | 18 |
Python Completions | 27 |
Ruby Completions | 8 |
Total Stars | 7 |
% of votes with a positive feedback rating | 68% of 28 |
Total "Very Satisfied" Votes | 11 |
Total "Somewhat Satisfied" Votes | 16 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 29 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |