Last active
August 29, 2015 14:03
-
-
Save pingw33n/233df3719cd931bfe6f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ | |
> | |
, | |
[ | |
-------------------------------- | |
is space? | |
[ no | |
- is exclamation mark? | |
[ no | |
+++++++++++++++++++++++++++++++++ restore original character | |
print 'LETTER_' | |
> | |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
. | |
------- | |
. | |
> | |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
. | |
. | |
< | |
. | |
> | |
-- | |
. | |
+++++++++++++ | |
. | |
[-]<[-]< | |
copy character to the next cell | |
[->+>+<<]>>[-<<+>>]< | |
x y t1 t2 r | |
x = character | |
>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
y = 90 'Z' | |
>[-] t1 = 0 | |
>[-] t2 = 0 | |
>[-]+ r = 1 | |
<<< | |
while y != 0 | |
[ | |
- decrement y | |
< | |
- decrement x | |
>>[-] t1 = 0 | |
>[-] t2 = 0 | |
<<< | |
**** t1 = x | |
==== first move x to t1 and t2 | |
while x != 0 | |
[ | |
- | |
>>+ inc t1 | |
>+ inc t2 | |
<<< | |
] | |
>>> | |
==== next move t2 back to x | |
while t2 != 0 | |
[ | |
- dec t2 | |
<<<+>>> inc x | |
] | |
**************************** | |
+ t2 = 1 | |
< | |
if t1 (x) != 0 | |
[ | |
>- t2 = 0 | |
<[-] t1 = 0 | |
] | |
> | |
if t2 != 0 x lower or equal y | |
[ | |
>[-] r = 0 | |
<<<[-] y = 0 | |
>>[-] t2 = 0 | |
] | |
<< | |
] | |
>>> | |
if r != 0 then we have a lowercase letter | |
[ | |
<<<<< move back to the character | |
-------------------------------- | |
convert to upper case | |
>>>>> | |
[-] | |
] | |
<<<<< | |
. | |
[>]>> | |
] | |
< | |
[ | |
> | |
+++++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++++++++ | |
. | |
+++++++++++++++++++ | |
. | |
--------------------- | |
. | |
+++++++++ | |
. | |
----------- | |
. | |
++++++++++++ | |
. | |
------------ | |
. | |
+++++++++++++++++++ | |
. | |
----------- | |
. | |
++++++ | |
. | |
- | |
. | |
+++++++++++++++++ | |
. | |
------------------ | |
. | |
------------ | |
. | |
+++++++++++++++++ | |
. | |
------- | |
. | |
[>]>> | |
] | |
] | |
< | |
[ | |
> | |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
. | |
--- | |
. | |
--------------- | |
. | |
++ | |
. | |
++ | |
. | |
[>]>> | |
] | |
> | |
, | |
[ | |
< | |
++++++++++++++++++++++++++++++++ | |
. | |
+++++++++++ | |
. | |
----------- | |
. | |
>> | |
] | |
< | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment