0

How can I decode this strange text?

+[----->+++<]>++.+++.+++.+++++++.+[->+++<]>.[--->+<]>----.--------.[--->+<]>.---------.-----------.++.+++++++++++.+++[->+++<]>++.+.

This text should be a program.

ASCIIThenANSI
  • 865
  • 1
  • 9
  • 27

2 Answers2

1

The program outputs 'iloveskypegrab' when ran. It's a extremely simplified programming language called brainfuck.

Torkoal
  • 457
  • 5
  • 17
1

As Torkoal's answer says, it does indeed print iloveskypegrab when run. Let me explain what this program does, exactly:

Brainf**k (which will be referred to as BF) operates on an array of memory cells, also referred to as the tape, each initially set to zero. There is a pointer, initially pointing to the first memory cell. The commands are:

  • > Move the pointer to the right
  • < Move the pointer to the left
  • + Increment the memory cell under the pointer
  • - Decrement the memory cell under the pointer
  • . Output the character signified by the cell at the pointer
  • , Input a character and store it in the cell at the pointer
  • [ Jump past the matching ] if the cell under the pointer is 0
  • ] Jump back to the matching [ if the cell under the pointer is nonzero

All characters other than ><+-.,[] are comments and are ignored by the BF interpreter.
I won't explain too much here. Let's split up the program, piece by piece:

  • +[----->+++<]
    This is an example of a simple loop. It adds one to the current cell, then (because it's non-zero) goes into the brackets. It subtracts 5 from that cell, moves the pointer right one space, adds 3, and then moves back.
  • >++.
    This moves the pointer right one, adds 2, and outputs the current cell. It makes i.
  • +++.+++.
    Add 3, output, than add 3 more, and output again. This outputs the lo.
  • +++++++.
    Add 7, and output the character. This returns v.
  • +[->+++<]
    Add 1, and then inside the loop, subtract 1, then move right, add 3, and move back. Because the cell isn't zero until everything has been subtracted, it runs multiple times, and is a useful way of adding large numbers to cells quickly.
  • >.
    Output the cell we added to in the last loop. This returns e.
  • [--->+<]
    Keep subtracting 3 from the cell with e in it. While it's not zero, add one to the cell to the right.
  • >----.
    Move right, subtract 4, and output. This is the s.
  • --------.
    Subtract 8 from that cell, and output it again. This prints a k.
  • [--->+<]
    Same as before: Keep subtracting 3, and while that isn't zero, add one to the cell.
  • >.
    Still the same: move right and print the cell. This prints y.
  • ---------.
    Subtract 9. Output. This makes the p.
  • ----------.
    Subtract 10, output. Prints e.
  • ++.+++++++++++.
    By now this should become clear. Prints gr.
  • +++[->+++<]
    More loops - add 3, then continually subtract 1, and add 3 to the cell to the right.
  • >++.+.
    Move right. Add 2, output, add one, output. Outputs ab.

I hope this helped you! Let me know if something is wrong.

ASCIIThenANSI
  • 865
  • 1
  • 9
  • 27