-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbrainfuck-dirty.rb
25 lines (25 loc) · 1.12 KB
/
brainfuck-dirty.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$_=$$/$$;@_=$_+$_;$-_=$_-@_
$__=->_{_==[]||_==''?$.:$_+$__[_[$_..$-_]]}
@__=->_,&__{_==[]?[]:[__[_[$.]]]+@__[_[$_..$-_],&__]}
$_____=->_{@__[[*_],&->__{__[$.]}]}
@_____=->_{@__[[*_],&->__{__[$-_]}]}
$______=->_{___,______=$_____[_],@_____[_];_____=$__[___];____={};__=$.;(_=->{
____[______[__]]=___[__];(__+=$_)==_____ ?____:_[]})[]}
@______=->_,__{_=[*_]+[*__];____=$__[_];___={};__=$.;(_____=->{
___[_[__][$.]]=_[__][$_];(__+=$_)==____ ?___:_____[]})[]}
$_______=->_{$___=[];@___=$__[_];__=___=____=$.;$____,@____={},[]
(_____=->{
_[____]=='['?(@____<<____):$.
_[____]==']'?($____[@____[$-_]]=____;@____=@____[$...$.-@_]):$.
(____+=$_)==@___?$.:_____[]})[]
$____=$____=={}?{}:@______[$____,$______[$____]]
(______=->{_[__]==
'+'?($___[___]||=$.;$___[___]+=$_):_[__]==
'-'?($___[___]||=$.;$___[___]-=$_):_[__]==
'>'?(___+=$_):_[__]==
'<'?(___-=$_):_[__]==
'['?(__=($___[___]||$.)==$.?$____[__]:__):_[__]==
']'?(__=($___[___]||$.)!=$.?$____[__]:__):_[__]==
'.'?($><<(''<<$___[___])):$.
(__+=$_)==@___?_:______[]})[]}
$_______['++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.']