We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Rotten
Jump to navigation
Jump to search
Rotten is a joke esolang whose programs can have 2 forms:
<string>- Implicitly converted to13$<string><n>$<string>- Unescape the string (i.e.\nbecomes a newline), with\ibecoming a byte of input (if one doesn't exist then null bytes are assumed), then print it in ROT-<n>
Examples
Hello, World!
0$Hello, World! or Uryyb, Jbeyq!
Cat
(only works for 5 bytes of input)
\i\i\i\i\i
Fibonacci Sequence
Rotten is so convenient to program in, that if your program is a sequence, then the sequence elements (although only the ones you specified) are printed!
1, 1, 2, 3, 5, 8, 13
(prints 1, 1, 2, 3, 5, 8, 13)
Interpreter
Written in NodeJS.
function rotten(code)
{
if(code.match(/^[0-9]+(, ?[0-9])*$/))
console.log(code.replace(/,([^ ])/g, ", $1"));
else if(code.match(/^[0-9]+\$/))
console.log(rot(code.replace(/^[0-9]+\$/, ""), parseInt(code.split("$")[0])));
else
console.log(rot(code, 13))
}
function rot(s, n)
{
let res = "";
for(let i = 0; i < s.length; ++i)
{
if(s.charAt(i).match(/[A-Z]/))
{
res += String.fromCharCode((s.charCodeAt(i) - 65 + n) % 26 + 65);
}
else if(s.charAt(i).match(/[a-z]/))
{
res += String.fromCharCode((s.charCodeAt(i) - 97 + n) % 26 + 97);
}
else
{
res += s.charAt(i);
}
}
return res;
}