O
The version above, has several bugs.
Most visibly,
Corruption of chr(ord(Z) + 1) and chr(ord(z) + 1)
Less visibly,
Corruption of "high lowercase" chr(129 .. 192)
Corruption of chr(96)
I also, didn't like the style of the O(N^2) zigzag method of
checking to see if the input was within the range 65 .. 192.
So, I fixed the bugs, designed a O(N) method of checking to see
if the input was within a given range, reintroduced lots and lots of
bugs trying to copy the algorithm back to brainfuck, and removed
all of the new bugs that I introduced.
The result is,
+>>>>>>>>>+>+>+>+>+>+ <<<<< //initialize nopslide<<<<<<<<<[ >>>> [-] <<<< , + [ - >>> [-] + //set is_alpha to 1 //copy input to test_up test_down >> [-] > [-] <<<<<< [ >>>> + > + > + <<<<<< - ] >>>> [ <<<< + >>>> - ] //subtract 65 from test_up test_down ++++++++ [ > -------- > -------- << - ] > - > - //set comflag if test_up or test_down > [-] << [ >> + > ] >>> [<] << [ > + > ] >> [<] < [ - > ] > [<] < [ //while (comflag) <<<< [-] //clear is_alpha >> + //increment test_up >> [-] //set comflag if test_up or test_down << [ >> + > ] >>> [<] << [ > + > ] >> [<] < [ - > ] > [<] < [ //if (comflag) <<<< + //set is_alpha >>> - //decrement test_down > [-] //set comflag if test_up or test_down << [ >> + > ] >>> [<] << [ > + > ] >> [<] < [ - > ] > [<] ] > [<] < ] <<<< [ //128 character loop input was within 65 to 192 //subtract 65 > ++++++++ [ <<<< -------- >>>> - ] <<<< - //prepare for division > [-] > [-] >>>>>>>>>>>>> [-] <<<<<<<<<<<<<<< [ >>>> + >>>>>>>>>>> + <<<<<<<<<<<<<<< - ] >>>> [ <<<< + >>>> - ] ++++ [ << ++++++++ >> - ] << - //divide by 32 >>>>>>>>>>>>> [ > [-] + <<<<<<<<<<<<<< [ >>>>>>>>>>>>>> - <<<<<<<< ] >>>>>> [<] >>>>>>>> [ <<<<<<<<<<<<<<< + >>> ++++ [ << ++++++++ >> - ] >>>>>>>>>>>> - ] <<<<<<<<<<<<<< - >>>>>>>>>>>>> - ] //set input to 0 minus mod32inv plus 31 <<<<<<<<<<<<<<< [ - ] >> [ << - >> - ] >> ++++ [ <<<< ++++++++ >>>> - ] <<<< - //copy div32 to test_up test_down >>>>> [-] > [-] <<<<< [ >>> + > + > + <<<<< - ] >>> [ <<< + >>> - ] > - > - > [-] //set comflag << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] < [ //same comparison loop as before //except now checking for div32 being with 0 to 1 //instead of input being within 65 to 192 <<<< [-] >>> - > [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] < [ <<<< + >> + >> [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] ] > [<] < ] <<<< [ //64 character loop input was within 65 to 128 //copy input to test_up test_down >> [-] > [-] <<<<<< [ >>>> + > + > + <<<<<< - ] >>>> [ <<<< + >>>> - ] +++++ [ > ----- > ----- << - ] >>> [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] < [ //same comparison loop as before //except now checking if input is within 0 to 25 <<<< [-] >>> - > [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] < [ <<<< + >> + >> [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] ] > [<] < ] <<<< [ //52 character loop input was within 65 to 128 and 0 to 25 >> [-] > [-] <<<<<< [ >>>> + > + > + <<<<<< - ] >>>> [ <<<< + >>>> - ] > ------------ > ------------ > [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] < [ //same comparison loop as before //except now checking if input is within A to L <<<< [-] >>> - > [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] < [ <<<< + >> + >> [-] << [>> + > ] >>> [<] << [> + > ] >> [<] < [ - > ] > [<] ] > [<] < ] <<<<<<< ------------- //apply rot13 >>> [ //add 26 if A to L [-] > +++++ [<<<< +++++ >>>> - ] <<<<+ >>> ] ] //end if 52 loop ] //end if 64 loop //fix up all lowercase add 32 times div32 << [ >>> ++++ [ <<<< ++++++++ >>>> - ] <<< - ] //add 65 >>> ++++++++ [ <<<< ++++++++ >>>> - ] <<<< + >>> //move pointer back to position at loop start ] //end if 128 loop <<< . [-] //print out and zero cell >>>> + //set continflag <<<< ] >>>> [ <<<< + >>>> - ] //copy continflag to input to stop if previous <<<< //character was 255]
Cells used are labeled
0: input
1: div32
2: mod32inv
3: is_alpha, is_al
4: copybuf, tmpidx, continflag
5: test_up
6: test_down
7: comflag
8: zero
9 .. 14: nopslide
15: divtmp
16: wrapflag
Sorry for the length -- this forum could really use some spoiler or readmore tags.