| Paradigm(s) | imperative |
|---|---|
| Designed by | User:BoundedBeans |
| Appeared in | 2022 |
| Memory system | variable-based |
| Dimensions | one-dimensional |
| Computational class | Turing complete |
| Reference implementation |
99 bottles of pain is an esoteric programming language by User:BoundedBeans with the syntax based around the output of a common programming problem.
To start, each verse of the song is given a number. It must go down by 1 every verse, but it may start at any number, not just 99, and it may also end at any number, not just 1. A blank line is also required between verses, and will not be interpreted as a subroutine.
Each verse in the song goes like this:
(verse number) bottles of b(x1)r on the wall (verse number) bottles of b(x2)r Take (x3) down Pass it around (verse number) bottles of b(x4)r (operator) on the wall.
So we have 5 arguments to each verse: x1, x2, x3, x4, operator. All operators are quaternary, a.k.a. they accept 4 arguments always.
x1, x2, and x4 have a binary sequence assigned to them, while x3 has a decimal representation of the integer. Note that the binary sequence should always begin with 1, and the decimal should follow this rule as well. x1, x2, x3, and x4 are not direct numbers, but instead each index a variable (multiple can refer to the same variable in a verse). Operations are performed between these variables based on the word before " on the wall". The result is always stored in x4, except for "set" which also stores a result in x2, and "put" which stores a value in all of its arguments.
e - 0 E - 1
Put these operators before " on the wall".
"put": Declare the 4 values and initialize them all as 1. If they already exist, throw an error. "placed": Add the 4 values together and store the result in x4. "sitting": Do (x1 - x2) - (x3 - x4), store the result in x4. "laying": Multiply the 4 values together and store the result in x4. "lying": Do (x1 / x2) / (x3 / x4), store the result in x4. "unnoticed": Do (x1 % x2) - (x3 * x4), store the result in x4 "set": Set x2 to x1, set x4 to x3 nothing: no-op, but can still check x4 for a loop.
But there are some extra things allowing even more functionality.
The first is that the "Pass" in "Pass it around" can contain an extra 's'. This causes it to print x4 as an ascii value if negative, and as a number if positive. To print negative numbers, just print a hyphen first.
The second is that the "Take" in "Take one down" can have a lowercase 't'. This causes it to accept input into x3 before performing the calculation, and keeping this value in x3 after it's done.
Finally, while loops can be implemented by adding a space before some verses. Whatever verse is directly above the indented code will run that code if and only if x4 is greater than 0 after the calculation, and will loop as long as x4 continues to be greater than 0. Also, these can be nested, by including more spaces, and they also have a separate verse number, so make sure to remember to not skip numbers outside of it, or the code will break. Note that current x4 does not stay checking for 0, the one checked for 0 is the x4 of the last statement in the loop.
Hello world: (I suspect I may have made a mistake somewhere here, but this was painful to write and I don't want to check it for errors)
99 bottles of bEr on the wall 99 bottles of bEer Take 3 down Pass it around 99 bottles of bEeer put on the wall 98 bottles of bEeEr on the wall 98 bottles of bEEer Take 7 down Pass it around 98 bottles of bEeeer put on the wall 97 bottles of bEr on the wall 97 bottles of bEer Take 3 down Pass it around 97 bottles of bEeer sitting on the wall //now 100 is 0 96 bottles of bEeer on the wall 96 bottles of bEeer Take 1 down Pass it around 96 bottles of bEer placed on the wall //now 10 is 2 95 bottles of bEer on the wall 95 bottles of bEeer Take 4 down Pass it around 95 bottles of bEeEr placed on the wall //Now 101 is 3 99 bottles of bEeEr on the wall 99 bottles of bEEer Take 1 down Pass it around 99 bottles of bEr set on the wall //here I copy my 3 to 110 //luckily for me, there's a pretty easy way to add things to the code without changing all numbers below, as long as we know that x4 is positive, which for verse 95 of main, //is guaranteed to be 3. So now I have saved the 3 //now we just need to set it to 0 98 bottles of bEEEr on the wall 98 bottles of bEEEr Take 7 down Pass it around 98 bottles of bEEEr sitting on the wall 94 bottles of bEer on the wall 94 bottles of bEer Take 5 down Pass it around 94 bottles of bEeEr laying on the wall //now 101 is 72 93 bottles of bEeer on the wall 93 bottles of bEeeer Take 1 down Pass it around 93 bottles of bEr set on the wall //we've duplicated our zero, now we can overwrite it safely, set 1 to 1 which does nothing 92 bottles of bEeer on the wall 92 bottles of bEeer Take 5 down Passs it around 92 bottles of bEeer sitting on the wall //now 100 is -72, print 91 bottles of bEEer on the wall 91 bottles of bEeEr Take 1 down Pass it around 91 bottles of bEr set on the wall //now we have our 3 back in the original place, so we can safely overwrite it again 90 bottles of bEeer on the wall 90 bottles of bEeeer Take 8 down Passs it around 90 bottles of bEEer placed on the wall //adding -72 and 3 gets -69, which is E 89 bottles of bEeeEr on the wall 89 bottles of bEeEer Take 11 down Pass it around 89 bottles of bEEeer put on the wall //it's racking my brain a bit with too small amounts of variables, so I'm making more 88 bottles of bEer on the wall 88 bottles of bEeeEr Take 1 down Pass it around 88 bottles of bEr set on the wall //duplicate the 2 87 bottles of bEeeEr on the wall 87 bottles of bEeeer Take 8 down Pass it around 87 bottles of bEeeEr placed on the wall //get a 4 86 bottles of bEeeer on the wall 86 bottles of bEeEer Take 1 down Pass it around 86 bottles of bEr set on the wall //duplicate the zero again 85 bottles of bEeer on the wall 85 bottles of bEeeEr Take 10 down Passs it around 85 bottles of bEeEer sitting on the wall //subtract -72 - 4 to get -76, print out L 84 bottles of bEeer on the wall 84 bottles of bEeeEr Take 10 down Passs it around 84 bottles of bEeEer sitting on the wall //print L again 83 bottles of bEeEer on the wall 83 bottles of bEEer Take 1 down Pass it around 83 bottles of bEr set on the wall //set 110 to 1010, since we'll use L later 82 bottles of bEEer on the wall 82 bottles of bEeEr Take 7 down Passs it around 82 bottles of bEEEr sitting on the wall 81 bottles of bEEEr on the wall 81 bottles of bEEr Take 1 down Pass it around 81 bottles of bEr set on the wall //set 11 to 111 since we'll need O later //now we need to make 44. This will be interesting 80 bottles of bEEeEr on the wall 80 bottles of bEEEer Take 15 down Pass it around 80 bottles of bEeeeer put on the wall //I'm creating more variables to help with getting the 44 79 bottles of bEeEr on the wall 79 bottles of bEeEEr Take 1 down Pass it around 79 bottles of bEr set on the wall //duplicate the 3 78 bottles of bEer on the wall 78 bottles of bEeeer Take 8 down Pass it around 78 bottles of bEeEEr placed on the wall //make 5 77 bottles of bEer on the wall 77 bottles of bEer Take 11 down Pass it around 77 bottles of bEEeer laying on the wall //make 10 76 bottles of bEeeer on the wall 76 bottles of bEeeer Take 12 down Pass it around 76 bottles of bEEeEr placed on the wall //make 11 75 bottles of bEer on the wall 75 bottles of bEer Take 13 down Pass it around 75 bottles of bEEEer laying on the wall //make 44 74 bottles of bEeeer on the wall 74 bottles of bEeeEr Take 1 down Pass it around 74 bottles of bEr set on the wall //duplicate the 0 73 bottles of bEeeEr on the wall 73 bottles of bEEEer Take 9 down Passs it around 73 bottles of bEeeEr sitting on the wall //make -44, print 72 bottles of bEeeer on the wall 72 bottles of bEeeer Take 13 down Pass it around 72 bottles of bEEEEr placed on the wall //make 12 71 bottles of bEeeer on the wall 71 bottles of bEeeer Take 14 down Passs it around 71 bottles of bEEEEr placed on the wall //make -32, print 70 bottles of bEr on the wall 70 bottles of bEEEer Take 1 down Pass it around 70 bottles of bEEEEr set on the wall //clear up some of the variables 69 bottles of bEer on the wall 69 bottles of bEEr Take 1 down Pass it around 69 bottles of bEr set on the wall //duplicate the 2 68 bottles of bEEr on the wall 68 bottles of bEEr Take 1 down Pass it around 68 bottles bEEr laying on the wall //make 8 67 bottles of bEeeer on the wall 67 bottles of bEeeEr Take 1 down Pass it around 67 bottles of bEr set on the wall //duplicate the 0 66 bottles of bEEEr on the wall 66 bottles of bEEr Take 9 down Passs it around 66 bottles of bEeeEr sitting on the wall //make -87, print 65 bottles of bEeeer on the wall 65 bottles of bEeeer Take 8 down Passs it around 65 bottles of bEEEr placed on the wall //print O again by adding 0 to it 64 bottles of bEeeer on the wall 64 bottles of bEeeEr Take 1 down Pass it around 64 bottles of bEr set on the wall //duplicate the 0 63 bottles of bEEEr on the wall 63 bottles of bEeEr Take 9 down Passs it around 63 bottles of bEeeEr sitting on the wall //make -82, print 62 bottles of bEeeer on the wall 62 bottles of bEeeer Take 8 down Passs it around 62 bottles of bEeEer placed on the wall //print L again 61 bottles of bEeer on the wall 61 bottles of bEeeer Take 2 down Passs it around 61 bottles of bEer placed on the wall
(Supposed to print in all caps with a comma and no exclamation point ("HELLO, WORLD") but I think I may have made a mistake early on which would affect everything afterwards)
Assuming variables can store any rational number, the language is Turing complete.
A brainfuck implementation written in 99 bottles of pain, as a turing completeness proof. a ! ends the brainfuck code.
Note that implementations strictly complying to the wiki page will not be able to parse this, as this uses 99 BoPa as py99BoPa.py understands this. It also requires variables to store any rational number.
710 bottles of ber on the wall,
710 bottles of bEr.
take 2 down,
Pass them around,
708 bottles of bEr put on the wall.
708 bottles of bEeer on the wall,
708 bottles of bEeEr.
take 6 down,
Pass them around,
702 bottles of bEeEr put on the wall.
702 bottles of bEeeer on the wall,
702 bottles of bEeeeeEr.
take 43 down,
Pass them around,
659 bottles of bEeeeeEr put on the wall.
659 bottles of bEeEEeEr on the wall,
659 bottles of bEeEEEer.
take 60 down,
Pass them around,
599 bottles of bEeEEEer put on the wall.
599 bottles of bEeEEeEEr on the wall,
599 bottles of bEeEEEeEr.
take 100 down,
Pass them around,
499 bottles of bEeEEEeEr put on the wall.
499 bottles of bEEeeEEer on the wall,
499 bottles of bEEeeEEEr.
take 104 down,
Pass them around,
395 bottles of bEEeeEEEr put on the wall.
395 bottles of bEEeEeEer on the wall,
395 bottles of bEEeEeEEr.
take 108 down,
Pass them around,
287 bottles of bEEeEeEEr put on the wall.
287 bottles of bEEeEeeEer on the wall,
287 bottles of bEEeEeeeEr.
take 109 down,
Pass them around,
178 bottles of bEEeEeeeEr put on the wall.
// v100 — program
// v101 — tape
// v102 — program length
// v103 — bracket stack
// v104 — program pointer
// constants {{{
// 33 = '!', 43..46 = "+,-."
// 60..62 = "<=>", 91..93 = "[/]"
// added for debugging purposes:
// 210, 209 - -'\n', -'\t'
178 bottles of ber on the wall,
178 bottles of ber.
take 0 down,
Pass them around,
178 bottles of ber sitting on the wall.
178 bottles of ber on the wall,
178 bottles of ber.
take 2 down,
Pass them around,
176 bottles of ber placed on the wall.
176 bottles of ber on the wall,
176 bottles of bEEr.
take 3 down,
Pass them around,
173 bottles of bEEr placed on the wall.
173 bottles of bEeer on the wall,
173 bottles of bEeer.
take 4 down,
Pass them around,
169 bottles of bEeer placed on the wall.
169 bottles of bEeer on the wall,
169 bottles of ber.
take 0 down,
Pass them around,
169 bottles of ber placed on the wall.
169 bottles of bEeer on the wall,
169 bottles of ber.
take 6 down,
Pass them around,
163 bottles of ber placed on the wall.
163 bottles of bEeer on the wall,
163 bottles of bEEEr.
take 7 down,
Pass them around,
156 bottles of bEEEr placed on the wall.
156 bottles of bEeer on the wall,
156 bottles of bEEr.
take 0 down,
Pass them around,
156 bottles of bEEr placed on the wall.
156 bottles of bEeeer on the wall,
156 bottles of bEer.
take 0 down,
Pass them around,
156 bottles of bEer placed on the wall.
156 bottles of bEEr on the wall,
156 bottles of bEr.
take 1 down,
Pass it around,
155 bottles of bEr laying on the wall.
155 bottles of bEeeer on the wall,
155 bottles of bEr.
take 33 down,
Pass them around,
122 bottles of bEr placed on the wall.
122 bottles of bEeEeEEr on the wall,
122 bottles of ber.
take 0 down,
Pass them around,
122 bottles of ber placed on the wall.
122 bottles of bEeEEeer on the wall,
122 bottles of ber.
take 0 down,
Pass them around,
122 bottles of ber placed on the wall.
122 bottles of bEeEEeEr on the wall,
122 bottles of ber.
take 0 down,
Pass them around,
122 bottles of ber placed on the wall.
122 bottles of bEeEEEer on the wall,
122 bottles of bEeEr.
take 8 down,
Pass them around,
114 bottles of bEeEr placed on the wall.
114 bottles of bEEEEeer on the wall,
114 bottles of bEr.
take 0 down,
Pass them around,
114 bottles of bEr placed on the wall.
114 bottles of bEEr on the wall,
114 bottles of bEeeeeEr.
take 1 down,
Pass it around,
113 bottles of bEeeeeEr laying on the wall.
113 bottles of ber on the wall,
113 bottles of bEEer.
take 0 down,
Pass them around,
113 bottles of bEEer sitting on the wall.
113 bottles of bEeEEEeEr on the wall,
113 bottles of bEer.
take 1 down,
Pass it around,
112 bottles of bEer sitting on the wall.
112 bottles of ber on the wall,
112 bottles of bEeeer.
take 3 down,
Pass them around,
109 bottles of bEeeer sitting on the wall.
109 bottles of ber on the wall,
109 bottles of bEeeer.
take 2 down,
Pass them around,
107 bottles of bEeeer sitting on the wall.
107 bottles of bEeeer on the wall,
107 bottles of bEeeer.
take 4 down,
Pass them around,
103 bottles of bEeeer laying on the wall.
103 bottles of ber on the wall,
103 bottles of bEEeeEeer.
take 0 down,
Pass them around,
103 bottles of bEEeeEeer set on the wall.
103 bottles of ber on the wall,
103 bottles of bEEeeEEer.
take 0 down,
Pass them around,
103 bottles of bEEeeEEer set on the wall.
// }}}
// read the code, for simplicity binaryfuck encoded {{{
103 bottles of ber on the wall,
103 bottles of ber.
take 0 down,
Pass them around,
103 bottles of ber on the wall.
1881 bottles of ber on the wall,
1881 bottles of bEEeEeEEr.
take 104 down,
Passs them around,
1777 bottles of bEEeEeEEr set on the wall.
1777 bottles of ber on the wall,
1777 bottles of bEEeEeeer.
Take 0 down,
Pass them around,
1777 bottles of bEEeEeeer sitting on the wall.
1777 bottles of bEr on the wall,
1777 bottles of bEEeEeEer.
take 0 down,
Pass them around,
1777 bottles of bEEeEeEer set on the wall.
// +
1777 bottles of ber on the wall,
1777 bottles of bEeEeEEr.
take 0 down,
Pass them around,
1777 bottles of bEeEeEEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1777 bottles of ber on the wall,
1777 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
1672 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1672 bottles of ber on the wall,
1672 bottles of ber.
take 0 down,
Pass them around,
1672 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
1672 bottles of bEr on the wall,
1672 bottles of bEEeEeEer.
take 104 down,
Pass them around,
1568 bottles of bEEeEeEer set on the wall.
// -
1568 bottles of ber on the wall,
1568 bottles of bEeEEeEr.
take 0 down,
Pass them around,
1568 bottles of bEeEEeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1568 bottles of ber on the wall,
1568 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
1463 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1463 bottles of ber on the wall,
1463 bottles of ber.
take 0 down,
Pass them around,
1463 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
1463 bottles of bEr on the wall,
1463 bottles of bEEeEeEer.
take 104 down,
Pass them around,
1359 bottles of bEEeEeEer set on the wall.
// >
1359 bottles of ber on the wall,
1359 bottles of bEEEEEer.
take 0 down,
Pass them around,
1359 bottles of bEEEEEer sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1359 bottles of ber on the wall,
1359 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
1254 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1254 bottles of ber on the wall,
1254 bottles of ber.
take 0 down,
Pass them around,
1254 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEer on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
1254 bottles of bEr on the wall,
1254 bottles of bEEeEeEer.
take 104 down,
Pass them around,
1150 bottles of bEEeEeEer set on the wall.
// <
1150 bottles of ber on the wall,
1150 bottles of bEEEEeer.
take 0 down,
Pass them around,
1150 bottles of bEEEEeer sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1150 bottles of ber on the wall,
1150 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
1045 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
1045 bottles of ber on the wall,
1045 bottles of ber.
take 0 down,
Pass them around,
1045 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
1045 bottles of bEr on the wall,
1045 bottles of bEEeEeEer.
take 104 down,
Pass them around,
941 bottles of bEEeEeEer set on the wall.
// .
941 bottles of ber on the wall,
941 bottles of bEeEEEer.
take 0 down,
Pass them around,
941 bottles of bEeEEEer sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
941 bottles of ber on the wall,
941 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
836 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
836 bottles of ber on the wall,
836 bottles of ber.
take 0 down,
Pass them around,
836 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEeer on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
836 bottles of bEr on the wall,
836 bottles of bEEeEeEer.
take 104 down,
Pass them around,
732 bottles of bEEeEeEer set on the wall.
// ,
732 bottles of ber on the wall,
732 bottles of bEeEEeer.
take 0 down,
Pass them around,
732 bottles of bEeEEeer sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
732 bottles of ber on the wall,
732 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
627 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
627 bottles of ber on the wall,
627 bottles of ber.
take 0 down,
Pass them around,
627 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEeEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
627 bottles of bEr on the wall,
627 bottles of bEEeEeEer.
take 104 down,
Pass them around,
523 bottles of bEEeEeEer set on the wall.
// [
523 bottles of ber on the wall,
523 bottles of bEeEEeEEr.
take 0 down,
Pass them around,
523 bottles of bEeEEeEEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
523 bottles of ber on the wall,
523 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
418 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
418 bottles of ber on the wall,
418 bottles of ber.
take 0 down,
Pass them around,
418 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEEer on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
418 bottles of bEr on the wall,
418 bottles of bEEeEeEer.
take 104 down,
Pass them around,
314 bottles of bEEeEeEer set on the wall.
// ]
314 bottles of ber on the wall,
314 bottles of bEeEEEeEr.
take 0 down,
Pass them around,
314 bottles of bEeEEEeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
314 bottles of ber on the wall,
314 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
209 bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEer.
take 0 down,
Pass them around,
No more bottles of bEer sitting on the wall.
209 bottles of ber on the wall,
209 bottles of ber.
take 0 down,
Pass them around,
209 bottles of ber on the wall.
1 bottle of bEeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEEEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
209 bottles of ber on the wall,
209 bottles of bEEeEeEer.
take 104 down,
Pass them around,
105 bottles of bEEeEeEer set on the wall.
// !
105 bottles of ber on the wall,
105 bottles of bEeeeeEr.
take 0 down,
Pass them around,
105 bottles of bEeeeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEr.
take 0 down,
Pass them around,
No more bottles of bEr placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
105 bottles of ber on the wall,
105 bottles of bEEeEeeEr.
take 105 down,
Pass them around,
No more bottles of bEEeEeeEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEr.
take 0 down,
Pass them around,
No more bottles of bEr placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
// }}}
103 bottles of ber on the wall,
103 bottles of ber.
Take 0 down,
Pass them around,
103 bottles of ber on the wall.
// move the head back to the begining {{{
103 bottles of ber on the wall,
103 bottles of ber.
take 102 down,
Pass them around,
1 bottle of ber set on the wall.
1 bottle of ber on the wall,
1 bottle of ber.
take 1 down,
Pass it around,
No more bottles of ber sitting on the wall.
101 bottles of bEEeeEeer on the wall,
101 bottles of bEeeer.
take 100 down,
Pass them around,
1 bottle of bEeeer lying on the wall.
1 bottle of ber on the wall,
1 bottle of ber.
take 1 down,
Pass it around,
No more bottles of ber sitting on the wall.
// }}}
// execute {{{
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
209 bottles of bEr on the wall,
209 bottles of bEEeEeEer.
take 1 down,
Pass it around,
208 bottles of bEEeEeEer set on the wall.
208 bottles of bEEeeEeer on the wall,
208 bottles of bEeeer.
take 100 down,
Pass them around,
108 bottles of bEeeer unnoticed on the wall.
108 bottles of ber on the wall,
108 bottles of bEEer.
take 0 down,
Pass them around,
108 bottles of bEEer sitting on the wall.
// ]
207 bottles of bEEeeEeEr on the wall,
207 bottles of bEeeeeeeeer.
take 101 down,
Pass them around,
106 bottles of bEeeeeeeeer unnoticed on the wall.
212 bottles of bEEeeEEEr on the wall,
212 bottles of bEEeeEEer.
take 106 down,
Pass them around,
106 bottles of bEEeeEEer unnoticed on the wall.
106 bottles of bEEeEeeer on the wall,
106 bottles of bEEeEeEer.
take 106 down,
Pass them around,
No more bottles of bEEeEeEer sitting on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
100 bottles of ber on the wall,
100 bottles of bEr.
take 0 down,
Pass them around,
100 bottles of bEr sitting on the wall.
100 bottles of bEEeeEeer on the wall,
100 bottles of bEeeer.
take 100 down,
Pass them around,
No more bottles of bEeeer lying on the wall.
No more bottles of ber on the wall,
No more bottles of bEr.
take 0 down,
Pass them around,
No more bottles of bEr sitting on the wall.
No more bottles of bEr on the wall,
No more bottles of bEEeEeEer.
take 0 down,
Pass them around,
No more bottles of bEEeEeEer set on the wall.
106 bottles of bEr on the wall,
106 bottles of bEEeEeEer.
take 106 down,
Pass them around,
No more bottles of bEEeEeEer sitting on the wall.
107 bottles of bEr on the wall,
107 bottles of bEEeEeEEr.
take 0 down,
Pass them around,
107 bottles of bEEeEeEEr set on the wall.
107 bottles of bEEeeEEEr on the wall,
107 bottles of bEEeeEEer.
take 107 down,
Pass them around,
No more bottles of bEEeeEEer unnoticed on the wall.
No more bottles of ber on the wall,
No more bottles of bEEeEeEEr.
take 0 down,
Pass them around,
No more bottles of bEEeEeEEr sitting on the wall.
103 bottles of bEEeeEEEr on the wall,
103 bottles of bEEeeEEer.
take 103 down,
Pass them around,
No more bottles of bEEeeEEer lying on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
No more bottles of ber on the wall,
No more bottles of bEeeer.
take 0 down,
Pass them around,
No more bottles of bEeeer sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
// [
207 bottles of bEEeeEeEr on the wall,
207 bottles of bEeeeeeeeer.
take 101 down,
Pass them around,
106 bottles of bEeeeeeeeer unnoticed on the wall.
1 bottle of bEEeeEEer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of bEEeEeeer on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
106 bottles of bEr on the wall,
106 bottles of bEEeEeEer.
take 106 down,
Pass them around,
No more bottles of bEEeEeEer sitting on the wall.
1 bottle of ber on the wall,
1 bottle of ber.
take 1 down,
Pass it around,
No more bottles of ber set on the wall.
102 bottles of bEr on the wall,
102 bottles of ber.
take 0 down,
Pass them around,
102 bottles of ber placed on the wall.
102 bottles of bEeeer on the wall,
102 bottles of bEr.
take 1 down,
Pass it around,
101 bottles of bEr laying on the wall.
101 bottles of ber on the wall,
101 bottles of ber.
take 1 down,
Pass it around,
100 bottles of ber set on the wall.
100 bottles of bEEeeEeer on the wall,
100 bottles of bEeeer.
take 100 down,
Pass them around,
No more bottles of bEeeer unnoticed on the wall.
No more bottles of ber on the wall,
No more bottles of bEEer.
take 0 down,
Pass them around,
No more bottles of bEEer sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEr.
take 0 down,
Pass them around,
No more bottles of bEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
No more bottles of bEr on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
// ,
208 bottles of bEEeeEeEr on the wall,
208 bottles of bEeeeeeeeer.
take 101 down,
Pass them around,
107 bottles of bEeeeeeeeer unnoticed on the wall.
107 bottles of ber on the wall,
107 bottles of bEEeEeEer.
take 0 down,
Pass them around,
107 bottles of bEEeEeEer sitting on the wall.
107 bottles of bEEeEeEEr on the wall,
107 bottles of bEeeeeeeeer.
take 107 down,
Passs them around,
No more bottles of bEeeeeeeeer unnoticed on the wall.
No more bottles of ber on the wall,
No more bottles of bEEeEeEEr.
take 0 down,
Pass them around,
No more bottles of bEEeEeEEr placed on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
// .
207 bottles of bEEeeEeEr on the wall,
207 bottles of bEeeeeeeeer.
take 101 down,
Pass them around,
106 bottles of bEeeeeeeeer unnoticed on the wall.
106 bottles of ber on the wall,
106 bottles of bEEeEeEer.
Take 106 down,
Pass them around,
No more bottles of bEEeEeEer sitting on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
// <
1 bottle of bEeeeeeeeer on the wall,
1 bottle of bEr.
take 1 down,
Pass it around,
No more bottles of bEr laying on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
// >
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
101 bottles of bEEeeEeEr on the wall,
101 bottles of bEeeeeeeeer.
take 101 down,
Pass them around,
No more bottles of bEeeeeeeeer lying on the wall.
No more bottles of ber on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
// -
207 bottles of bEEeeEeEr on the wall,
207 bottles of bEeeeeeeeer.
take 101 down,
Pass them around,
106 bottles of bEeeeeeeeer unnoticed on the wall.
106 bottles of ber on the wall,
106 bottles of bEEeEeEer.
take 0 down,
Pass them around,
106 bottles of bEEeEeEer sitting on the wall.
106 bottles of bEeeeeeeeer on the wall,
106 bottles of bEr.
take 0 down,
Pass them around,
106 bottles of bEr sitting on the wall.
106 bottles of bEEeEeEer on the wall,
106 bottles of bEeeeeeeeer.
take 106 down,
Pass them around,
No more bottles of bEeeeeeeeer unnoticed on the wall.
No more bottles of bEEeEeEer on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
// +
207 bottles of bEEeeEeEr on the wall,
207 bottles of bEeeeeeeeer.
take 101 down,
Pass them around,
106 bottles of bEeeeeeeeer unnoticed on the wall.
106 bottles of ber on the wall,
106 bottles of bEEeEeEer.
take 0 down,
Pass them around,
106 bottles of bEEeEeEer sitting on the wall.
106 bottles of ber on the wall,
106 bottles of bEr.
take 0 down,
Pass them around,
106 bottles of bEr placed on the wall.
106 bottles of bEEeEeEer on the wall,
106 bottles of bEeeeeeeeer.
take 106 down,
Pass them around,
No more bottles of bEeeeeeeeer unnoticed on the wall.
No more bottles of bEEeEeEer on the wall,
No more bottles of ber.
take 0 down,
Pass them around,
No more bottles of ber placed on the wall.
No more bottles of ber on the wall,
No more bottles of bEEEr.
take 0 down,
Pass them around,
No more bottles of bEEEr sitting on the wall.
108 bottles of bEr on the wall,
108 bottles of ber.
take 0 down,
Pass them around,
108 bottles of ber placed on the wall.
108 bottles of bEeeer on the wall,
108 bottles of bEr.
take 1 down,
Pass it around,
107 bottles of bEr laying on the wall.
107 bottles of bEr on the wall,
107 bottles of bEEeEeEEr.
take 0 down,
Pass them around,
107 bottles of bEEeEeEEr set on the wall.
107 bottles of bEEeeEeer on the wall,
107 bottles of bEeeer.
take 107 down,
Pass them around,
No more bottles of bEeeer unnoticed on the wall.
// }}}
No more bottles of beer on the wall,
No more bottles of beer.
go to the store,
Buy some more,
99 bottles of beer on the wall.
The "short" format (again, see py99BoPa.py)
!.. 0 1 2 3
!.. 4 5 6 7
!.. 8 33 43 44
!.. 45 46 60 62
!.. 91 93 100 101
!.. 102 103 104 105
!.. 106 107 108 256
!.. 210 209 109 110
// v100 — program
// v101 — tape
// v102 — program length
// v103 — bracket stack
// v104 — program pointer
// constants {{{
// 33 = '!', 43..46 = "+,-."
// 60..62 = "<=>", 91..93 = "[/]"
// added for debugging purposes:
// 210, 209 - -'\n', -'\t'
-.. 0 0 0 0
+.. 0 0 2 2
+.. 0 3 3 3
+.. 4 4 4 4
+.. 4 0 0 5
+.. 4 0 6 6
+.. 4 7 7 7
+.. 4 3 0 8
+.. 8 2 0 33
*.. 3 1 1 33
+.. 8 1 33 43
+.. 43 0 0 44
+.. 44 0 0 45
+.. 45 0 0 46
+.. 46 5 8 60
+.. 60 1 0 62
*.. 3 33 1 93
-.. 0 6 0 93
-.. 93 2 1 91
-.. 0 8 3 210
-.. 0 8 2 209
*.. 8 8 4 256
=.. 0 100 0 101
=.. 0 102 0 103
// }}}
// read the code, for simplicity binaryfuck encoded {{{
... 0 0 0 1
=.i 0 107 104 105
-p. 0 104 0 107
=.. 1 106 0 0
// +
-.. 0 43 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 1 0 0 102
... 0 0 0 0
=.. 1 106 104 105
// -
-.. 0 45 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 1 0 0 100
+.. 1 0 0 102
... 0 0 0 0
=.. 1 106 104 105
// >
-.. 0 62 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 2 0 0 100
+.. 1 0 0 102
... 0 0 0 0
=.. 1 106 104 105
// <
-.. 0 60 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 3 0 0 100
+.. 1 0 0 102
... 0 0 0 0
=.. 1 106 104 105
// .
-.. 0 46 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 4 0 0 100
+.. 1 0 0 102
... 0 0 0 0
=.. 1 106 104 105
// ,
-.. 0 44 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 5 0 0 100
+.. 1 0 0 102
... 0 0 0 0
=.. 1 106 104 105
// [
-.. 0 91 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 6 0 0 100
+.. 1 0 0 102
... 0 0 0 0
=.. 1 106 104 105
// ]
-.. 0 93 0 105
-.. 0 2 0 106
-.. 0 105 105 105
-.. 0 2 0 106
... 0 0 0 106
*.. 8 1 1 100
+.. 7 0 0 100
+.. 1 0 0 102
... 0 0 0 0
=.. 0 106 104 105
// !
-.. 0 33 0 105
+.. 0 1 0 106
... 0 0 0 0
-.. 0 105 105 105
+.. 0 1 0 106
... 0 0 0 0
... 0 0 0 106
// }}}
.p. 0 0 0 210
// move the head back to the begining {{{
=.. 0 0 102 104
-.. 0 0 1 104
/.. 100 8 100 100
-.. 0 0 1 104
// }}}
// execute {{{
... 0 0 0 1
// .p. 0 0 0 104
// .p. 0 0 0 209
// .p. 0 0 0 101
// .p. 0 0 0 209
// .p. 0 0 0 103
// .p. 0 0 0 210
=.. 1 106 1 105
%.. 100 8 100 105
-.. 0 6 0 105
// ]
%.. 101 256 101 106
%.. 103 102 106 106
-.. 104 106 106 106
... 0 0 0 1
-.. 0 1 0 104
/.. 100 8 100 100
-.. 0 1 0 106
=.. 1 106 0 0
-.. 1 106 106 106
=.. 1 107 0 0
%.. 103 102 107 107
-.. 0 107 0 103
/.. 103 102 103 103
... 0 0 0 0
... 0 0 0 0
-.. 0 8 0 105
+.. 1 0 0 105
// [
%.. 101 256 101 106
*.. 102 1 1 103
+.. 104 0 0 103
... 0 0 0 0
-.. 1 106 106 106
=.. 0 0 1 107
+.. 1 0 0 104
*.. 8 1 1 100
=.. 0 0 1 108
%.. 100 8 100 108
-.. 0 6 0 108
-.. 0 1 0 107
-.. 0 7 0 108
... 0 0 0 0
+.. 1 0 0 108
+.. 1 0 0 107
... 0 0 0 0
+.. 1 0 0 108
... 0 0 0 107
-.. 0 7 0 105
+.. 1 0 0 105
// ,
%.. 101 256 101 106
-.. 0 106 0 101
%.i 107 256 107 107
+.. 0 107 0 101
-.. 0 7 0 105
+.. 1 0 0 105
// .
%.. 101 256 101 106
-p. 0 106 106 106
-.. 0 7 0 105
+.. 1 0 0 105
// <
*.. 256 1 1 101
-.. 0 7 0 105
+.. 1 0 0 105
// >
... 0 0 0 101
/.. 101 256 101 101
... 0 0 0 0
-.. 0 7 0 105
+.. 1 0 0 105
// -
%.. 101 256 101 106
-.. 0 106 0 101
// add 256 to avoid a 0 % 0
-.. 256 1 0 106
%.. 106 256 106 106
+.. 106 0 0 101
-.. 0 7 0 105
+.. 1 0 0 105
// +
%.. 101 256 101 106
-.. 0 106 0 101
+.. 0 1 0 106
%.. 106 256 106 106
+.. 106 0 0 101
-.. 0 7 0 105
+.. 1 0 0 104
*.. 8 1 1 100
=.. 1 107 0 0
%.. 100 8 107 107
// }}}
... 0 0 -99 0
// vim:fdm=marker:sw=4:ts=4:sts=4
(hopefully) equivalent python:
from fractions import Fraction
try:
from msvcrt import getch
except ImportError:
import sys
import tty
import termios
def getch():
"""
Gets a single character from STDIO.
"""
if sys.stdin.isatty():
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
try:
tty.setraw(fd)
out = sys.stdin.read(1)
if out == "\r":
out = "\n"
if out == "\3":
raise KeyboardInterrupt
return out
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old)
else:
return sys.stdin.read(1)
code = Fraction(0)
data = Fraction(0)
clen = Fraction(0)
bstack = Fraction(0)
while True:
inp = ord(getch())
print(chr(inp),end="",flush=True)
if inp == ord("+"):
code *= 8
code += 0
clen += 1
if inp == ord("-"):
code *= 8
code += 1
clen += 1
if inp == ord(">"):
code *= 8
code += 2
clen += 1
if inp == ord("<"):
code *= 8
code += 3
clen += 1
if inp == ord("."):
code *= 8
code += 4
clen += 1
if inp == ord(","):
code *= 8
code += 5
clen += 1
if inp == ord("["):
code *= 8
code += 6
clen += 1
if inp == ord("]"):
code *= 8
code += 7
clen += 1
if inp != ord("!"):
continue
break
print()
idx = clen - 1
while idx > 0:
code = (code / 8) / (code / code)
idx -= 1
while code % 8:
print(idx, data, bstack, sep="\t")
cell, instr = 1, 1
instr = code % 8 - code % instr
instr -= 6
if instr > 0: # ]
cell = data % 256 - data % cell
if cell > 0:
# nidx < idx
nidx = bstack % clen
nidx = idx - nidx - nidx + nidx
while nidx > 0:
idx -= 1
code /= 8
nidx -= 1
else:
temp = 1
temp = bstack % clen - temp % temp
bstack -= temp
if bstack > 0:
bstack = (bstack / clen) / (bstack / bstack)
instr -= 8
instr += 1
if instr > 0: # [
cell = data % 256 - data % cell
if cell > 0:
bstack *= clen
bstack += idx
assert bstack % 1 == 0
else:
temp = 1
while temp > 0:
idx += 1
code *= 8
ninstr = code % 8 - code % 1
ninstr -= 6
if ninstr > 0:
temp -= 1
ninstr -= 7
ninstr += 1
if ninstr > 0:
temp += 1
instr -= 7
instr += 1
if instr > 0: # ,
cell = data % 256 - data % cell
data -= cell
inp = ord(getch())
data += inp % 256
instr -= 7
instr += 1
if instr > 0: # .
cell = data % 256 - data % cell
print(chr(int(cell)),end="",flush=False)
instr -= 7
instr += 1
if instr > 0: # <
data *= 256
instr -= 7
instr += 1
if instr > 0: # >
if data > 0:
data = (data / 256) / (data / data)
instr -= 7
instr += 1
if instr > 0: # -
cell = data % 256 - data % cell
data -= cell
cell -= 1
cell %= 256
data += cell
instr -= 7
instr += 1
if instr > 0: # +
cell = data % 256 - data % 1
data -= cell
cell += 1
cell %= 256
data += cell
idx += 1
code *= 8