![]() |
|
Programming Challenge - Morse Code Cipher - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: Programming Challenge - Morse Code Cipher (/Thread-Programming-Challenge-Morse-Code-Cipher) Pages:
1
2
|
RE: Programming Challenge - Morse Code Cipher - Mushroom Face - 02-28-2014 (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? RE: Programming Challenge - Morse Code Cipher - 0xDEAD10CC - 03-01-2014 (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. 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"cSince 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. RE: Programming Challenge - Morse Code Cipher - Shebang - 03-01-2014 (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. RE: Programming Challenge - Morse Code Cipher - 0xDEAD10CC - 03-01-2014 I'd take a look to see what you've got, but... Quote:This paste has been removed! RE: Programming Challenge - Morse Code Cipher - Shebang - 03-02-2014 (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 ![]() I'm pretty sure I figured out the problem though. It was just how I was splitting up words
RE: Programming Challenge - Morse Code Cipher - 0xDEAD10CC - 03-02-2014 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? RE: Programming Challenge - Morse Code Cipher - Shebang - 03-02-2014 (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() I was, but I've lost the sheet of questions for it. I'll try and find it this coming week :thumbsup: |