Show all challenges →
This week we'd like you to design and implement a morse code interpreter. We'll provide you with a string of dots and dashes and your interpreter will need to translate these back to English.
We'll be using the letters A-Z only of the international (ITU) Morse code astandard.
| Letter | Morse | Letter | Morse |
| A | .- | N | -. |
| B | -... | O | --- |
| C | -.-. | P | .--. |
| D | -.. | Q | --.- |
| E | . | R | .-. |
| F | ..-. | S | ... |
| G | --. | T | - |
| H | .... | U | ..- |
| I | .. | V | ...- |
| J | .--- | W | .-- |
| K | -.- | X | -..- |
| L | .-.. | Y | -.-- |
| M | -- | Z | --.. |
Letters will be separated by a single blank space, words will be separated by 3 blank spaces. Your function should return uppercase characters only.
The Rules & Cheating
There are, of course, many ways to trick the system into giving you great performance by cheating. We are aware of a number of possible ways to fool the system
and have listed them below. Any submissions found to be cheating (either with the methods below or any other way we consider to against the good nature of this
game) will be removed.
- Using class variables, global variables or constants within your submission to cache results or code is not permitted and will be removed.
- Capturing the input data and then hard coding the result into your submission. Remember that at the end of the challenge we will re-test all passing submissions with new test data.
- Attempting to adjust garbage collection methods is considered to be cheating. All submissions must be run using the same environment and adjusting GC settings on a per submission bases is unfair.
- Deliberately attempting to slow down the execution of your code in order to rank in the 'Slowest' scoreboard (using sleep or other such techniques) is considered cheating.
- Adding comments and other superfluous code in order to rank in the 'Longest' scoreboard is considered cheating.
- Any other solutions which don't process the input data on every iteration using pure Ruby may be disqualified (although may be awesome so could well be considered).
Sponsors
aTech Media provide development time & hosting resources for this site. Why not check out some of their other things?