I recently stumbled across this image on wikimedia commons. It's a little bit of an information overload at first, but after examining it a bit it shows an interesting number system for writing nibbles.
Image created by user Watchduck.
First off a "nibble" is a 4 bit number which is really a number ranging from 0 to 15, with a particular emphasis on binary. This diagram shows a shorthand for writing such numbers with each number being one symbol. Ok, who cares? Plenty of people make up new symbols for numbers all the time. Well the interesting thing about these numbers is their symmetry.
If you take one of the symbols and mirror it horizontally you get the symbol of the number with the same bits in reverse order. For example the symbol that sort of looks like a 3 represents the bits 0011, it's horizontal mirror represents the bits 1100. Numbers which are symmetric along this mirror represent nibbles which are palindromes.
Similarly if you take a symbol and rotate it a half turn (180 degrees) you get the symbol for the bitwise compliment of that number, for example if you take the symbol that looks like a 7, it represents 0111, if you rotate it a half turn you get a symbol representing 1000.
Task
You will write a program or function which takes as input a nibble and outputs an image of a symbol. Your symbols are not required to be anything in specific but they are required to have the symmetry properties.
- Distinct nibbles should give distinct symbols
- The symbol for a nibble \$r\$ should be the mirror image of the symbol for the reverse of \$r\$.
- The symbol for a nibble \$r\$ should be the symbol for the bitwise compliment of \$r\$ rotated 180 degrees.
You may take input in any reasonable format and output in any image or graphical format. There are no additional requirements on resolution, aside from those implied by the rules. You can make your symbols as small as you wish as long as you satisfy the rules.
This is code-golf the goal is to minimize the size of your source code as measured in bytes.
p
the mirror image ofq
? It depends on the font. You can maybe say an answer in X language + Y font satisfies the requirement, but at that point it would really just be making a programming language to trivialize the problem. The challenge is graphical-output that's what it's about. \$\endgroup\$[0 0 1 1]
for3
\$\endgroup\$