oOo CODE

From Esolang
Jump to navigation Jump to search


oOo CODE, is a yet another programming language based on brainfuck. Its creation was inspired by the way how teenager trolls tend to use upper and lower case to draw attention to themselves.

oOo CODE syntax

A program in oOo CODE has a form of a plain text in the style of Bacon's Cipher. An instruction is encoded on exactly 3 Latin alphabet letters consecutive in the text. If the number of letters does not divide by three the remaining one or two at the end are discarded. Each instruction in oOo CODE has a corresponding Brainfuck command. To convert an oOo CODE instruction to Brainfuck each letter from a triplet has to be changed to one if it is upper case or 0 if it is lower case. Then the following conversion table should be used.

Binary code Brainfuck command oOo CODE example meaning
000 > ooo move pointer to the right
001 < ooO move pointer to the left
010 [ oOo loop begin - jump to the corresponding end of the loop instruction of there is 0 under the pointer
011 ] oOO loop end - jump to the corresponding beginning of the loop
100 - Ooo decrease value under the pointer by one
101 + OoO increase value under the pointer by one
110 . OOo print character under the pointer to output
111 , OOO read a character from the input and place it under the pointer

For the sake of punctuation rules any other characters (spaces, dots, comas, semicolons, numbers, etc.) can appear between the letters. Those are ignored during program execution. If you use punctuation marks wisely you can interleave Brainfuck and oOo CODE in one source file.

Writing oOo CODE programs

In order to write a oOo CODE you have to:

  1. Write your program in Brainfuck
  2. Write a beautiful story which length (the number of Latin alphabet letters) is 3 times the number of instructions in your Brainfuck program. If the story has one or two letters more, it is still fine.
  3. Divide the text into consecutive triples of Latin letters. Set letter casing in the text according to the Brainfuck code and conversion table. If the text has extra 1,2 letters at the end make them random-case.

Examples

Shakespeare used oOo CODE to write his first HELLO WORLD program:

JuLIeT
   O rOMeO, RoMEo! WHeREfOrE art tHoU RoMEo?
   DEnY ThY FaTHeR AnD ReFuse ThY NaME;
   oR, If ThoU wiLT not, BE but SWoRn mY loVe,
   aND i'Ll NO lONgER bE A cAPuLEt.
ROMeO
   [AsIdE] ShALl I HEar moRE, or sHAlL I sPEaK At THiS?
JuLIeT
   'TiS BUt Thy NamE thAt iS my EneMy;
   tHou ARt ThYSeLF, tHOUgH noT a mOntAguE.
   whAt's MOnTagUe? iT is Nor HanD, noR foOt,
   nOR arm (...)

(Brainfuck: ++++++++[>+++++++++>++++<<-]>.---.+++++++..+++.>.<++++++++.--------.+++.------.--------.)


Ultimate form of self-documenting code:

PROgRam reVERsES giVeN iNPut sEqUENcE

(Brainfuck: ,[>,]<[.<]+)

Another one:

xkcD rAndoM nUmbeR iS a ChallEnGe ThAt reqUIrES yOU tO rewrITe tHe pRoGRam iN Xkcd's 221st page in another language

(Brainfuck: >+>+>+[>+[-<+++>]<<]>.>>>>>>>>)

External resources