Find my version of “The Hex Game” here.
Being an embedded firmware engineer comes with regular conversions from hex (0xAF) to binary (1010 1111) and vice versa. The conversion rules are simple and there are many good calculators and tools to do the math for you.
I encounter lots of 8 to 32 bit registers in my daily coding life. Often single bits of those registers have to be written or read bitwise and I don’t want to have to either think about the conversion in my head for a longer time or use a converter. I’d much rather have this conversion become somewhat automatic in my head.
To practice quickly converting between 16 bit binary and hexadecimal numbers, I adapter “The Binary Game V2” which itself is a clone of “The Binary Game” by Cisco to display hex numbers rather than decimal numbers. Having never touched Javascript before, this took me longer than anticipated. I shall not touch Javascript again…
As a side note, converting large decimal numbers to hexadecimal is cumbersome by hand, as it involves long divisions and is better left to a computer.