PHP Challenge - Morse Code Translator

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

33 Replies - 29846 Views - Last Post: 16 June 2012 - 03:13 AM

#1 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

PHP Challenge - Morse Code Translator

Post icon  Posted 23 March 2012 - 06:11 AM

The Challenge - Morse Code Translator

Design an object that is capable of translating plain text to Morse code and vice versa.

Requirements
  • Proper Documentation & Comments
  • Proper Indentation
  • Object must implement the following interface
    Spoiler

  • For our convenience name the object MorseCodeTranslator


Deadline
Friday, April 13th, 2012 23:59 GMT


You can submit your code by sending me a personal message with the source. All submissions that meet the above requirements will be featured and the winner(s) will receive a badge.

Morse Code Characters
Spoiler


N.B. A single space will be used between characters while two spaces between words.
HELLO WORLD
.... . .-.. .-.. ---  .-- --- .-. .-.. -..


This post has been edited by codeprada: 23 March 2012 - 08:24 AM


Is This A Good Question/Topic? 4
  • +

Replies To: PHP Challenge - Morse Code Translator

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: PHP Challenge - Morse Code Translator

Posted 23 March 2012 - 07:27 AM

Can we assume that the Morse code will be formatted with the definition found on Wikipedia?
Was This Post Helpful? 0
  • +
  • -

#3 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

Re: PHP Challenge - Morse Code Translator

Posted 23 March 2012 - 07:59 AM

View Postsnoj, on 23 March 2012 - 10:27 AM, said:

Can we assume that the Morse code will be formatted with the definition found on Wikipedia?

I placed the morse code characters in a spoiler already if it's that you're talking about.
Was This Post Helpful? 0
  • +
  • -

#4 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: PHP Challenge - Morse Code Translator

Posted 23 March 2012 - 08:15 AM

View Postcodeprada, on 23 March 2012 - 08:59 AM, said:

View Postsnoj, on 23 March 2012 - 10:27 AM, said:

Can we assume that the Morse code will be formatted with the definition found on Wikipedia?

I placed the morse code characters in a spoiler already if it's that you're talking about.


It is not. There's no input delimiter or space character in Morse code. The lack of input for 3 beats indicates a new character and 7 beats is considered a space. For instance, A (.-) can be mistaken for 23 other charters in the map given. E (.), with every one.
Was This Post Helpful? 0
  • +
  • -

#5 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

Re: PHP Challenge - Morse Code Translator

Posted 23 March 2012 - 08:22 AM

Well for the sake of textually representing the pause between characters it will be a space and two spaces represent the start of a new word. I'll update the post.
Was This Post Helpful? 0
  • +
  • -

#6 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2268
  • View blog
  • Posts: 9,482
  • Joined: 29-May 08

Re: PHP Challenge - Morse Code Translator

Posted 24 March 2012 - 05:21 PM

Spoiler

Was This Post Helpful? 1
  • +
  • -

#7 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 799
  • View blog
  • Posts: 1,681
  • Joined: 30-January 09

Re: PHP Challenge - Morse Code Translator

Posted 27 March 2012 - 06:12 PM

The morse code for . is . - . - . -? That's one hell of a cruel joke...

This post has been edited by e_i_pi: 27 March 2012 - 06:13 PM

Was This Post Helpful? 0
  • +
  • -

#8 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: PHP Challenge - Morse Code Translator

Posted 03 April 2012 - 04:52 PM

Well it's kind of like this:
http://www.htmlentit.../html/entities/
Was This Post Helpful? 0
  • +
  • -

#9 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,288
  • Joined: 28-March 11

Re: PHP Challenge - Morse Code Translator

Posted 04 April 2012 - 04:33 PM

Ok, here is my take at it, in Assembly of course. Just whipped up the toMorseCode, I will work on the toPlainText when I get a chance, then I will zip it up and send to you. It is OVERLY commented :P
Spoiler

And this is the output of my sample string used:

Quote

-.-. --- -.. . .--. .-. .- -.. .- .--. .... .--. -.-. .... .- .-.. .-.. . -. --. . --..-- -- --- .-. ... . -.-. --- -.. . - .-. .- -. ... .-.. .- - --- .-.

Was This Post Helpful? 2
  • +
  • -

#10 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3039
  • View blog
  • Posts: 10,618
  • Joined: 08-August 08

Re: PHP Challenge - Morse Code Translator

Posted 04 April 2012 - 06:02 PM

I don't see how that implements the interface. :wink:

This post has been edited by CTphpnwb: 04 April 2012 - 06:03 PM

Was This Post Helpful? 1
  • +
  • -

#11 Duckington  Icon User is offline

  • D.I.C Addict

Reputation: 170
  • View blog
  • Posts: 608
  • Joined: 12-October 09

Re: PHP Challenge - Morse Code Translator

Posted 05 April 2012 - 11:57 AM

**REMOVED CODE**

This post has been edited by codeprada: 06 April 2012 - 05:10 AM
Reason for edit:: You were to send your submission in a PM.

Was This Post Helpful? 0
  • +
  • -

#12 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: PHP Challenge - Morse Code Translator

Posted 08 April 2012 - 04:49 PM

How many people have participated so far?

From what I've seen in the non-PHP submissions every one has the same idea. :)

This post has been edited by hiddenghost: 08 April 2012 - 04:53 PM

Was This Post Helpful? 0
  • +
  • -

#13 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

Re: PHP Challenge - Morse Code Translator

Posted 08 April 2012 - 06:27 PM

@hiddenghost There are 9 PHP submissions so far.
Was This Post Helpful? 0
  • +
  • -

#14 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,288
  • Joined: 28-March 11

Re: PHP Challenge - Morse Code Translator

Posted 08 April 2012 - 06:31 PM

and one oddball Assembly submission :D
Was This Post Helpful? 0
  • +
  • -

#15 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: PHP Challenge - Morse Code Translator

Posted 08 April 2012 - 07:44 PM

Cool. I can't wait to see what other people have done.
I'm still learning to code so this is a real learning experience.

It's funny. I have been trying to learn assembly too. It's a long road for me though.
We shall see what happens.
Trying to focus on c++ first.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3