Morse code interpreter

217 views
Skip to first unread message

Jasper SMCE

unread,
Jul 2, 2019, 5:18:26 AM7/2/19
to mitappinv...@googlegroups.com
Hi! I'm making a cheat(read: assistive) app for me and my friend to use in keep talking and nobody explodes, and I have seen other methods of figuring out the morse code using appinventor, but that was long after I had realised this forum existed. So, I saw a couple, and was wondering...
Is there any reason my method is going to break? Or better yet, is there a way I can further optimise this for speed?
I am not done yet, I only started this two days ago, and morse was by far the most irritating to do, and if you are wondering why I'm using tinydb, it's for a toggle that allows for fun mode located on the main page,for numbers and reverse lookup to be performed, which is otherwise wasted space during regular gameplay.
blocks(2).png

ABG

unread,
Jul 2, 2019, 9:59:50 AM7/2/19
to MIT App Inventor Forum
Is it okay to cheat by pre-processing a file of Morse Code
translations into a TinyDB reverse lookup table?

Or would that be too easy?

ABG



morse.csv

Jasper SMCE

unread,
Jul 2, 2019, 10:55:26 AM7/2/19
to MIT App Inventor Forum
Literally had that idea five minutes ago and was exploring deas as to how to implement this. I was just planning to see if I could preset the thingy before executing the program. Thanks for this suggestion, but I have a question, how would the data be stored using this list? As I see it, I'd have to read the file on screen init. and then from an empty variable's new blank list, import the results of the file read into it. But what structure would it use? Would it save the letter to correspond with the morse? or would it just save each "tab" as it's own index reference?
Actually, I just looked into the blocks, there's a "pairs" block, that I assume I'd use to find the related key. That's nice and all, but how would I have otherwise implemented this? I don't quite see a way to make pairs natively in the environment. and as a aside, when searching for the pairs, does it matter which pair side I check? Or can I just use this table directly and if I wanted to, search .- and "A" interchangably using the same table? Or do I also have to duplicate the same table pairing but invert it to have the morse on the left too?

Jasper SMCE

unread,
Jul 2, 2019, 10:57:50 AM7/2/19
to MIT App Inventor Forum
As a second aside, I'm now slightly sad that this method might work way better than my lookup arrays method. Took me basically a whole day to figure that out, with multiple ideas coming and going revolving around the binary direction layer idea, but only just got it working then. Ah well.

Peter Mathijssen

unread,
Jul 2, 2019, 11:13:27 AM7/2/19
to MIT App Inventor Forum
Don't be sad. What you did is the fun of learning to use App Inventor. There are multiple solutions to a question. Your solution works and Abrahams will also work. Do what you think works for you and learn every day a new method or routine. 

ABG

unread,
Jul 2, 2019, 11:18:33 AM7/2/19
to MIT App Inventor Forum
Like @Peter said, we all had fun looking at a tree lookup in your blocks.

Doing things the hard way is always an education (once).

Any way, attached is my approach the lazy way.

ABG

blocks.png
Capture.PNG
CaptureWTF.PNG
Designer.PNG
Morse_Decode.aia

ABG

unread,
Jul 2, 2019, 11:37:44 AM7/2/19
to MIT App Inventor Forum
Regarding the lookup in pairs issue,
yes, my Morse table is backwards, so I
reversed the tags and values when I loaded it into a TinyDB.

If you wanted to use it for a lookup in pairs, you would have to build
a reversed version at first load time.

Or get a good column editor or spreadsheet to 
build it right in csv.

ABG

Jasper SMCE

unread,
Jul 2, 2019, 11:48:53 AM7/2/19
to MIT App Inventor Forum
Haha, thanks for the reassurance, I'll definitely come back if I have another project to bodge, or if I have another problem with this project!

Jasper SMCE

unread,
Jul 2, 2019, 11:51:45 AM7/2/19
to MIT App Inventor Forum
Thanks, ABG, for the help too! I think I'll keep my original code running for the first part, and use your suggested csv method for the reverse. Not that I think mine runs faster (it probably doesn't), but I think I'd like to at least let this piece have it's moment for being devised. Also, it probably doesn't incur a large enough penalty in terms of time before explosion.

Jasper SMCE

unread,
Jul 5, 2019, 11:52:59 AM7/5/19
to MIT App Inventor Forum
As a followup, I have finally finished the morse section of the app (except the interpretation of what the possible frequencies are). I've given up on my method entirely, since for some reason , my mesh of your idea and mine just couldn't quite work for whatever reason, and basically scrapped it to a new page. The result looks like this.

The first one is the new, cleaner one, the second is the old, 2/3rds functioning one.
Again, thanks for your help on this, @ABG!
blocks(4).png
blocks(3).png

ABG

unread,
Jul 5, 2019, 12:30:55 PM7/5/19
to MIT App Inventor Forum
Thanks for posting!
ABG

Reply all
Reply to author
Forward
0 new messages