MoreMathRPN/Quine
Jump to navigation
Jump to search
← go back
Quines are a bit tricky, these programs have three parts: the data (the initial list of numbers), the number printer (first repeat), and the text printer (second repeat). The numbers are chosen to be the unicode values of all the code's characters in order.
e.g. the first number is 35, and the first command is #. If I didn't indent the program, a lot of the 32's would be removed.
35 10 104 111 108 100 32 108 10 100 101 108 32 48 10 109 32 36 108 32 49 10 114 101 112 101 97 116 32 36 108 10 32 62 62 62 32 48 10 32 49 10 32 45 10 32 45 62 32 49 10 32 105 110 100 32 93 49 32 48 10 32 100 101 108 32 50 10 32 111 117 116 112 117 116 86 10 32 111 117 116 112 117 116 67 32 49 48 10 110 101 120 116 10 114 101 112 101 97 116 32 36 108 10 32 62 62 62 32 48 10 32 49 10 32 45 10 32 45 62 32 49 10 32 105 110 100 32 93 49 32 48 10 32 100 101 108 32 50 10 32 111 117 116 112 117 116 67 32 93 48 10 32 100 101 108 32 48 10 110 101 120 116 # hold l del 0 m $l 1 repeat $l >>> 0 1 - -> 1 ind ]1 0 del 2 outputV outputC 10 next repeat $l >>> 0 1 - -> 1 ind ]1 0 del 2 outputC ]0 del 0 next
if you consider outputV
to be cheating:
35 10 104 111 108 100 32 108 10 100 101 108 32 48 10 109 32 36 108 32 49 10 114 101 112 101 97 116 32 36 108 10 32 62 62 62 32 48 10 32 49 10 32 45 10 32 45 62 32 49 10 32 105 110 100 32 93 49 32 48 10 32 100 101 108 32 50 10 32 49 10 32 104 111 108 100 32 100 10 32 100 101 108 32 48 10 32 62 62 32 48 10 32 49 48 10 32 37 10 32 45 62 32 49 10 32 49 48 10 32 47 10 32 102 108 111 111 114 10 32 49 10 32 62 62 32 49 10 32 115 116 101 112 10 32 45 10 32 54 10 32 42 10 32 106 109 112 32 93 48 10 32 32 100 101 108 32 48 10 32 32 112 108 97 99 101 32 100 10 32 32 49 10 32 32 43 10 32 32 106 109 112 32 45 50 48 10 32 100 101 108 32 48 10 32 100 101 108 32 48 10 32 114 101 112 101 97 116 32 36 100 10 32 32 52 56 10 32 32 43 10 32 32 111 117 116 112 117 116 67 32 93 48 10 32 32 100 101 108 32 48 10 32 110 101 120 116 10 32 111 117 116 112 117 116 67 32 49 48 10 110 101 120 116 10 114 101 112 101 97 116 32 36 108 10 32 62 62 62 32 48 10 32 49 10 32 45 10 32 45 62 32 49 10 32 105 110 100 32 93 49 32 48 10 32 100 101 108 32 50 10 32 111 117 116 112 117 116 67 32 93 48 10 32 100 101 108 32 48 10 110 101 120 116 # hold l del 0 m $l 1 repeat $l >>> 0 1 - -> 1 ind ]1 0 del 2 1 hold d del 0 >> 0 10 % -> 1 10 / floor 1 >> 1 step - 6 * jmp ]0 del 0 place d 1 + jmp -20 del 0 del 0 repeat $d 48 + outputC ]0 del 0 next outputC 10 next repeat $l >>> 0 1 - -> 1 ind ]1 0 del 2 outputC ]0 del 0 next