Background
HQ0-9+-INCOMPUTABLE?! is a half-joke programming language introduced in Internet Problem Solving Contest 2011, Problem H.
HQ9+ is an esoteric programming language specialized for certain tasks. For example, printing “Hello, world!” or writing a quine (a program that prints itself) couldn’t be any simpler. Unfortunately, HQ9+ doesn’t do very well in most other situations. This is why we have created our own variant of the language, HQ0-9+-INCOMPUTABLE?!.
A HQ0-9+-INCOMPUTABLE?! program is a sequence of commands, written on one line without any whitespace (except for the trailing newline). The program can store data in two memory areas: the buffer, a string of characters, and the accumulator, an integer variable. Initially, the buffer is empty and the accumulator is set to 0. The value of the buffer after executing all the commands becomes the program’s output.
HQ0-9+-INCOMPUTABLE?! supports the following commands:
command | description |
---|---|
h , H |
appends helloworld to the buffer |
q , Q |
appends the program source code to the buffer (not including the trailing newline) |
0-9 |
replaces the buffer with n copies of its old value – for example, 2 doubles the buffer (aab would become aabaab , etc.) |
+ |
increments the accumulator |
- |
decrements the accumulator |
i , I |
increments the ASCII value of every character in the buffer |
n , N |
applies ROT13 to the letters and numbers in the buffer (for letters ROT13 preserves case; for digits we define ROT13(d) = (d + 13) mod 10 ) |
c , C |
swaps the case of every letter in the buffer; doesn’t change other characters |
o , O |
removes all characters from the buffer whose index, counted from the end, is a prime or a power of two (or both); the last character has index 1 (which is a power of 2) |
m , M |
sets the accumulator to the current buffer length |
p , P |
removes all characters from the buffer whose index is a prime or a power of two (or both); the first character has index 1 (which is a power of 2) |
u , U |
converts the buffer to uppercase |
t , T |
sorts the characters in the buffer by their ASCII values |
a , A |
replaces every character in the buffer with its ASCII value in decimal (1–3 digits) |
b , B |
replaces every character in the buffer with its ASCII value in binary (exactly eight 0 /1 characters) |
l , L |
converts the buffer to lowercase |
e , E |
translates every character in the buffer to l33t using the following table:ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 48(03=6#|JXLM~09Q257UVW%Y2 a6<d3f9hijk1m^0p9r57uvw*y2 O!ZEA$G/B9 |
? |
removes 47 characters from the end of the buffer (or everything if it is too short) |
! |
removes 47 characters from the beginning of the buffer (or everything if it is too short) |
To prevent code injection vulnerabilities, during the execution of your program the buffer must never contain non-alphanumeric characters, i.e. characters other than A-Z, a-z, and 0-9. Should this happen, the program fails with a runtime error, and your submission will be rejected.
The original problem statement contains limits about the code length and buffer length, but I removed them in this challenge. This is also reflected in the interpreter link below. (If you need even larger buffer, you can change the MAX_BUFFER
constant near the top. I doubt using a longer buffer will give reasonably short code though.)
Task
Output the string (which is 50 digits of Pi without leading 3.
)
14159265358979323846264338327950288419716939937510
in HQ0-9+-INCOMPUTABLE?!.
An answer is scored as follows:
- Each occurrence of
Q
/q
adds 1,000,000 points. - Each occurrence of
E
/e
adds 10,000 points. - Each occurrence of any other valid command adds 1 point.
Lowest score wins.
Bonus: +500 bounty to the first answer that achieves the score of 9,999 points or lower. I have confirmed that this is possible. claimed by dingledooper
If you're wondering about the role of the accumulator, you're right: it still does nothing useful.
Q
removed as it's not even an exact quine. \$\endgroup\$