Created
July 1, 2013 15:25
-
-
Save abevoelker/5901817 to your computer and use it in GitHub Desktop.
Deadfish interpreter written in Ruby (http://esolangs.org/wiki/Deadfish)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
n = 0 | |
while true | |
print '>> ' | |
gets.chomp.each_char do |c| | |
n = 0 if [-1, 256].include?(n) | |
case c | |
when 'd' then n -= 1 | |
when 'i' then n += 1 | |
when 'o' then puts n | |
when 's' then n *= n | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment