blob: 1e55b21d0bd9e7730fc36fccebc9d99bd1815f29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
```ruby
s = '
+++++ +++++
[
> +++++ +++++ + > +++++ +++++ +
> +++++ +++++ > +++++ +++++
<<<< -
]
> . > +++++ . >> ++ . < +++++ . < . > . < .
'
m=[p=n=0,0,0,0,0];c=-1;case s[c];when'>';p+=1;when'<';p-=1
when'+';m[p]+=1;when'-';m[p]-=1;when'.';print m[p].chr;when
'[';loop{;case s[c+=1];when'[';n+=1;when']';break if n==0;
n-=1;end;}if m[p]==0;when']';loop{;case s[c-=1];when']';n+=1
;when'[';break if n==0;n-=1;end;}if m[p]!=0;end while s[c+=1]
```
|