Login Register


Programming Challenge - Morse Code Cipher filter_list
Author
Message
RE: Programming Challenge - Morse Code Cipher #11
(02-28-2014, 04:55 AM)0xDEAD10CC Wrote: snip

Its easier in VB.net to use a string than it is a char. Due to the programming lessons often given.

P.S. Why the dictionary again?
[Image: Glffl03.png]

Reply

RE: Programming Challenge - Morse Code Cipher #12
(02-28-2014, 06:50 AM)Mushroom Face Wrote: Its easier in VB.net to use a string than it is a char. Due to the programming lessons often given.

P.S. Why the dictionary again?

In VB.NET it's just as easy, it just takes another explicit character to say that you're using a char... i.e.:
Code:
"A"c

Since coincidentally, the people who invented the language decided to use ' as a comment identifier. *chuckles*

Hey, which post are you referring to when you ask about the dictionary? I use a dictionary over others because it's also the most modern class to be using in the .NET framework for such features. It essentially superseded the Hashtable by the time it came out in System.Collections. Yeah, you'll see various benchmarks between all of these similar classes though from all of the keener's of the .NET framework...

The main difference is, a Hashtable stores the data as a type of System.Object, kind of like an ArrayList, which makes for the same reason why a List<T> is preferred instead. A Dictionary of a specific type (not System.Object) yields better performance than a Hashtable for value types typically, because with the Hashtable, phenomena such as boxing and unboxing need to occur when you insert or retrieve an entry from the collection. So both implement the IDictionary interface, but both are still quite different.

Reply

RE: Programming Challenge - Morse Code Cipher #13
(02-28-2014, 04:55 AM)0xDEAD10CC Wrote: -snip -

As per your guidance, I attempted to fix my class. Everything almost works. (http://pastebin.com/ecWX2snv)

However, specifically when decoding a Morse message, any word spaces are replaced by "????", which either means that it detected an invalid character (which shouldn't even be monitored), or it can't handle spaces. I'm not sure what's going on. I made the parameters overloadable, but I'm not sure if that's necessary or even helpful to specify.

Reply

RE: Programming Challenge - Morse Code Cipher #14
I'd take a look to see what you've got, but...

Quote:This paste has been removed!

Reply

RE: Programming Challenge - Morse Code Cipher #15
(03-01-2014, 10:54 PM)0xDEAD10CC Wrote: I'd take a look to see what you've got, but...

It's because of the bracket at the end Tongue

I'm pretty sure I figured out the problem though. It was just how I was splitting up words Tongue

Reply

RE: Programming Challenge - Morse Code Cipher #16
Alright, well as a sidenote, you should avoid the compatibility namespace. i.e. Don't use Split()
Code:
Dim Words As String() = Split(ToChange, " ")

Split() != String.Split().

Aside from that, you can use an enumerator on a String object; no need to redundantly cast it to a char array to iterate the internal characters.

You said you were going to post up your own challenge?

Reply

RE: Programming Challenge - Morse Code Cipher #17
(03-02-2014, 05:57 AM)0xDEAD10CC Wrote: Alright, well as a sidenote, you should avoid the compatibility namespace. i.e. Don't use Split()
Code:
Dim Words As String() = Split(ToChange, " ")

Split() != String.Split().

Aside from that, you can use an enumerator on a String object; no need to redundantly cast it to a char array to iterate the internal characters.

You said you were going to post up your own challenge?

I was, but I've lost the sheet of questions for it. I'll try and find it this coming week :thumbsup:

Reply







Users browsing this thread: 2 Guest(s)