Please participate in the meta discussion about reopening this challenge before casting a vote.

# Introduction

This challenge was inspired by .

Deadfish is a non-Turing-complete programming language, created by Jonathan Todd Skinner. It has an accumulator register and contains 4 commands, i, d, s, and o, standing for increment, decrement, square, and output, respectively. While this seems simple enough, the original implementation has some quirks that must be present in your interpreter.

Unlike a similar challenge here, this does not require the interpreter to be interactive.

# Challenge

The challenge is to write a fully functional Deadfish interpreter, quirks included. The following requirements must be met:

• The accumulator must be more than 8 bits wide.
• When an i is encountered, increment the accumulator by 1.
• When a d is encountered, decrement the accumulator by 1.
• When an s is encountered, square the value of the accumulator.
• When an o is encountered, print the value of the accumulator along with a newline.
• When any other character is encountered, including control characters and whitespace but not a newline, print a newline.
• If and only if the accumulator equals -1 or 256, set the accumulator to 0.

# Test cases

From the esolangs article:

iissso -> 0
diissisdo -> 288
iissisdddddddddddddddddddddddddddddddddo -> 0


# Rules

• Input may be accepted through STDIN or as argument(s).
• Standard loopholes are disallowed
• This is , so the shortest solution in bytes wins
• @dylnan This one doesn't impose an interactivity requirement, however, allowing more languages to be used Feb 15 '18 at 17:26
• True. I think people will say you should make a meta post about it. If they say it's a good idea and you link to the meta post on this post then people will be okay with it. Feb 15 '18 at 17:30
• @Uriel yes it should! Feb 15 '18 at 17:40
• Feb 15 '18 at 19:32

a=0s={"i":(a=>a+1),"d":(a=>a-1),"s":(a=>a*a),"o":(a=>[print(a),a][1])}for i:input(){a=s[i](a)if a in[-1,256]{a=0}}