-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a Petooh Hello World #35
Comments
FYI: eval 'm=Hash.new(p=0);'+ARGF.read.gsub(/[^adehkKoOru]/,'').gsub(
/(kO|Ko|[Kk]u(dah|karek|d))/,
'Kudah' => 'p+=1;',
'kudah' => 'p-=1;',
'Ko' => 'm[p]+=1;',
'kO' => 'm[p]-=1;',
'Kud' => '(',
'kud' => ')while((m[p]&=255)!=0);',
'Kukarek' => 'putc m[p];',
'kukarek' => 'm[p]=STDIN.getbyte if !STDIN.eof;') |
It seems that code is not valid and returns something like "H������� ����" |
Checked with different implementations even after invalid character removal. |
This is an indication of broken looping constructs in the embedded brainfuck interpreters. You can run the BF translation with any standard interpreter, and I've put the code below so you can try others than the one I linked. >++++++++[-<+++++++++>]<.>>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----.>->
+++..+++.>-.<<+[>[+>+]>>]<--------------.>>.+++.------.--------.>+.>+. The cleaned Petooh translation is
Another working BF interpreter is this: #!/usr/bin/ruby
eval 'm=Hash.new(p=0);'+ARGF.read.gsub(/./,
'<'=>'p-=1;',
'>'=>'p+=1;',
'-'=>'m[p]-=1;',
'+'=>'m[p]+=1;',
'['=>'(',
']'=>')while((m[p]&=255)!=0);',
'.'=>'putc m[p];',
','=>'m[p]=STDIN.getbyte if !STDIN.eof;') Note your example HW from #38 is a trivial multiply loop, runnable by many broken interpreters. |
From the documentation and example interpreters this is a valid Petooh "Hello World!" program.
For various reasons it appears that only one of the interpreters can run it successfully.
The text was updated successfully, but these errors were encountered: