Talk:Painfuck

From Esolang
Jump to navigation Jump to search

Questions

  • What happens if an odd number is halved? Is the result rounded down? [RE: yes, use integer rounding]
  • When cloning the value to the left, what happens when the pointer is at the beginning of the tape? [RE: it stays where it was]
  • What does it mean to do the next command half the time? [RE: it does the command 50% of occasions, basically there is a 1/2 probability next command runs.]

- Bangyen (talk) 19:44, 4 May 2022 (UTC)

Encryption/Decryption Explanation

By User:Lemonz:

  • RE: Ok yea, I suck at documenting this kind of thing, but here's an explanation:
  • To get the right commands:
  • Apply decrypt:
    • Get all the remaining characters after the one that was just run,
    • Find the character AFTER state.
    • Then, Find the corresponding character in the BEFORE state
    • Thats the new character in that position, place it there and remove the old.
  • So:
  • pso is the starting state
  • the p is kept as is.
  • the s and o are changed to the corresponding characters: s corresponds to t, and o corresponds to s.
  • Keep the t as so, and change the third character (the substituted s) to the corresponding character (t)


  • When the interpreter runs the program. do this to get the new command:
    • Get all the remaining characters after the one that was just run,
    • Find the character BEFORE state.
    • Then, Find the corresponding character in the AFTER state
    • Thats the new character in that position, place it there and remove the old.
  • so, the excample ptt is run like this:
  • keep p as is
  • the t's are encrypted to s (the corresponding)
  • run the s normally, then encrypt the next s to an o
  • these two processes should result in each other, as the program after the interpreter does the encrypting is the same as what you wanted to write.