Draft

Morse Code (translate text to and from morse code)

18 of 61dinomight

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[".-"]
  $textToMorse["a"]
  $morseToText[".-"]
  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"
  $textToMorse["a"];
  $morseToText[".-"];

Stats:

CreatedNov 20, 2017
Warriors Trained454
Total Skips26
Total Code Submissions849
Total Times Completed61
JavaScript Completions18
PHP Completions18
Python Completions27
Ruby Completions8
Total Stars7
% of votes with a positive feedback rating68% of 28
Total "Very Satisfied" Votes11
Total "Somewhat Satisfied" Votes16
Total "Not Satisfied" Votes1
Total Rank Assessments29
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • dinomight Avatar
Ad