Skip to content

Instantly share code, notes, and snippets.

@Oderjunkie
Last active April 14, 2022 05:35
Show Gist options
  • Select an option

  • Save Oderjunkie/d7cd20f780f7a8938231c87bd6ff95d7 to your computer and use it in GitHub Desktop.

Select an option

Save Oderjunkie/d7cd20f780f7a8938231c87bd6ff95d7 to your computer and use it in GitHub Desktop.
brainfuck, but even more painful.
/*----------------------*/
___=process;__$='stdin';_$_='setRawMode';_$$='on';$__='data';$_$='exit';$$_='slice';$$$=_$=>_$;___[__$][_$_]((_=>_==_)());__=(_=>(_==_)>>_)()<<(_=>(_==_)+(_==_)+(_==_)+(_==_)+(_==_)+(_==_)+(_==_)+(_==_)+(_==_)+(_==_)+(_==_)+(_==_))();$$=(_=>_>>_)();$=($=>(_=>_(_))(_=>$($=>_(_)($))))($=>_=>--_?[...$(_),(_=>_>>_)()]:[(_=>(_==_)>>_)()])(__);___[__$][_$$]($__,_$=>($$$(_$),$$$=_$=>_$));_=_=>($=>(_=>_(_))(_=>$($=>_(_)($))))($_=>([_,__])=>_==''?($[$$]?$_([__,__]):___[$_$]()):_[(_=>_>>_)()]=='+'?($[$$]==(_=>(_=>((_<<(_<<(_+(_<<_))))-_))((_==_)>>_))()?$[$$]-=$[$$]:$[$$]++,$_([_[$$_]((_=>(_==_)>>_)()),__])):_[(_=>_>>_)()]=='>'?(($$==__?$$-=$$:$$++), $_([_[$$_]((_=>(_==_)>>_)()),__])):_[(_=>_>>_)()]=='['?$[$$]?(()=>$_([($=>(_=>_(_))(_=>$($=>_(_)($))))($=>([_,__])=>_[(_=>_>>_)()]=='['?$([_[$$_]((_=>(_==_)>>_)()),++__]):_[(_=>_>>_)()]==']'?(--__ ? $([_[$$_]((_=>(_==_)>>_)()),__]):_):$([_[$$_]((_=>(_==_)>>_)()),__]))([_,(_=>_>>_)()]),__]))():$_([_[$$_]((_=>(_==_)>>_)()),__]):_[(_=>_>>_)()]=='.'?($[$$]?(___.stdout.write(String.fromCharCode($[$$])),$_([_[$$_]((_=>(_==_)>>_)()),__])):$$$=_$=>($[$$]=_$[(_=>_>>_)()],$_([_[$$_]((_=>(_==_)>>_)()),__]))):$_)([_,_]);
/*--- CODE ENDS HERE ---*/
// usage:
_('>..');
// brainfuckedup operates on a type of 4096 cells, where each cell is an unsigned 8 bit number
// on startup, the tape is filled with 0s, except the currently selected cell, which is a 1
// the entire program is wrapped in a `while(CELLS[CURRENT])`
// + increment current cell
// > move right one cell
// . current cell is?
// |- nonzero -> print out as ASCII
// `- zero -> take a single ASCII character as input
// [...] current cell is?
// |- nonzero -> execute code inbetween
// `- zero -> skip code inbetween
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment