www.eamoncaddigan.net

Content and configuration for https://www.eamoncaddigan.net
git clone https://git.eamoncaddigan.net/www.eamoncaddigan.net.git
Log | Files | Refs | Submodules | README

index.md (2317B)


      1 ---
      2 title: "2023, Day 12"
      3 date: 2023-12-12T18:55:04-08:00
      4 draft: false
      5 ---
      6 
      7 [Devine had a sharp critique
      8 today](https://merveilles.town/@neauoire/111568838011217063):
      9 
     10 > Reading the december adventure feed, nearly halfway into the month, you'd
     11 > expect people to have started to play with stuff, but the feed reads like
     12 > most are lost in the weeds of setting their servers or environment and
     13 > whatnot so they can finally begin. For a chillout event, it looks
     14 > exhausting af
     15 
     16 So I _have_ been hacking for the past week, but I've also been grouchy and
     17 whiny enough the past couple days that I _feel_ exhausting af[^jumps]. 
     18 
     19 Since Eli's whole vision for December Adventure is that it should be [fun
     20 and playful](https://eli.li/2022/12/9/december-adventure), I decided it
     21 seemed fun to work on a different part of my project: how should I encode
     22 the Morse code representation of each character[^fun]?
     23 
     24 In case anyone is unfamiliar with Morse Code, it's a method of encoding
     25 characters with signal durations (dots and dashes, or as radio folks call
     26 them, dits and dahs), each letter is represented by one to four dits or dahs
     27 (numerals are all represented by five). At first it seems obvious to use one
     28 bit per dit/dah, but it's a little tricky due to the varying length for each
     29 character.
     30 
     31 The solution I landed on was using two bits per dit/dah, with another two
     32 bits to indicate the end of a letter:
     33 
     34 bits | signal
     35 -----|--------------
     36 `01` | dit
     37 `11` | dah
     38 `00` | end of letter
     39 `10` | (unused)
     40 
     41 This allows each character (including numerals) to fit into a 16-bit short.
     42 Slightly over half of the letters would be able to fit into a byte, but by
     43 using a short for each one, implementing a lookup table will be much easier.
     44 Another shortcut I plan to take is to store the letters' encoding
     45 "backwards", with the first dit/dah in the lowest bits. This should let me
     46 play the tones for a character with a simple sequence of _shift_ and _and_
     47 operations.
     48 
     49 I haven't actually implemented anything yet, but I had fun thinking this
     50 through, and I look forward to coding this up!
     51 
     52 [^jumps]: In the same thread, they also helped me work through some
     53     questions about addressing that I had [yesterday]({{< ref
     54     "december-adventure/2023-11/index.md" >}}); thanks!
     55 
     56 [^fun]: Look, this kind of thing is _fun_ to me, ok?