Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

80%
+6 −0
Challenges Write a Deadfish Interpreter

A rewrite of this SE question with a simpler input format and guidelines. Challenge Deadfish uses a single accumulator, on which all commands are to be performed. It has the following commands: ...

8 answers  ·  posted 4y ago by Razetime‭  ·  last activity 2y ago by Zakk‭

#3: Post edited by user avatar Razetime‭ · 2021-02-02T05:44:57Z (almost 4 years ago)
added new testcases
  • *A rewrite of [this SE question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
  • ## Challenge
  • Deadfish uses a single accumulator, on which all commands are to be performed.
  • It has the following commands:
  • |Command|Description
  • |-|-
  • |`i`|increment the accumulator
  • |`d`|decrement the accumulator
  • |`s`|square the value of the accumulator
  • |`o`|output the value of the accumulator as a number
  • If, after executing a command, the accumulator is equal to -1 or equal to 256, the accumulator must be reset to zero.
  • ## I/O
  • Input can be taken as a single string, list of codepoints, or any other reasonable format. It is guaranteed that the input will only consist of deadfish commands.
  • Output can be given as an array of numbers, or just the numbers printed with separators between them.
  • ## Testcases
  • (some are borrowed from the [Esolangs wiki](https://esolangs.org/wiki/Deadfish#Mandatory_test_cases))
  • ```
  • iissso -> 0
  • diissisdo -> 288
  • iissisdddddddddddddddddddddddddddddddddo -> 0
  • isssoisoisoisoiso -> 1,4,25,676,458329
  • ooooosioiiisooo -> 0,0,0,0,0,1,16,16,16
  • iiii -> nothing
  • iiiiiiiissdiiiiiiiiiiiiiiiiio -> 4112
  • o -> 0
  • ```
  • [Without Outputs](https://dzaima.github.io/paste#0y8wsLi7O50rJBNKZxSn5XFAGIQBUCNKYiYS48kGgODM/E2gGkAUA)
  • *A rewrite of [this SE question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
  • ## Challenge
  • Deadfish uses a single accumulator, on which all commands are to be performed.
  • It has the following commands:
  • |Command|Description
  • |-|-
  • |`i`|increment the accumulator
  • |`d`|decrement the accumulator
  • |`s`|square the value of the accumulator
  • |`o`|output the value of the accumulator as a number
  • If, after executing a command, the accumulator is equal to -1 or equal to 256, the accumulator must be reset to zero.
  • ## I/O
  • Input can be taken as a single string, list of codepoints, or any other reasonable format. It is guaranteed that the input will only consist of deadfish commands.
  • Output can be given as an array of numbers, or just the numbers printed with separators between them.
  • ## Testcases
  • (some are borrowed from the [Esolangs wiki](https://esolangs.org/wiki/Deadfish#Mandatory_test_cases))
  • ```
  • iissso -> 0
  • diissisdo -> 288
  • iissisdddddddddddddddddddddddddddddddddo -> 0
  • isssoisoisoisoiso -> 1,4,25,676,458329
  • ooooosioiiisooo -> 0,0,0,0,0,1,16,16,16
  • iiii -> nothing
  • iiiiiiiissdiiiiiiiiiiiiiiiiio -> 4112
  • o -> 0
  • ```
#2: Post edited by user avatar Razetime‭ · 2021-02-01T03:48:47Z (almost 4 years ago)
  • *A rewrite of [this SE question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
  • ## Challenge
  • Deadfish uses a single accumulator, on which all commands are to be performed.
  • It has the following commands:
  • |Command|Description
  • |-|-
  • |`i`|increment the accumulator
  • |`d`|decrement the accumulator
  • |`s`|square the value of the accumulator
  • |`o`|output the value of the accumulator as a number
  • If, after executing a command, the accumulator is equal to -1 or equal to 256, the accumulator must be reset to zero.
  • ## I/O
  • Input can be taken as a single string, list of codepoints, or any other reasonable format. It is guaranteed that the input will only consist of deadfish commands.
  • Output can be given as an array of numbers, or just the numbers printed with separators between them.
  • ## Testcases
  • (some are borrowed from the [Esolangs wiki](https://esolangs.org/wiki/Deadfish#Mandatory_test_cases))
  • ```
  • iissso -> 0
  • diissisdo -> 288
  • iissisdddddddddddddddddddddddddddddddddo -> 0
  • isssoisoisoisoiso -> 1,4,25,676,458329
  • ooooosioiiisooo -> 0,0,0,0,0,1,16,16,16
  • ```
  • [Without Outputs](https://dzaima.github.io/paste#0y8wsLi7O50rJBNKZxSn5XFAGIQBUCNKYiYS48kGgODM/E2gGkAUA)
  • *A rewrite of [this SE question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
  • ## Challenge
  • Deadfish uses a single accumulator, on which all commands are to be performed.
  • It has the following commands:
  • |Command|Description
  • |-|-
  • |`i`|increment the accumulator
  • |`d`|decrement the accumulator
  • |`s`|square the value of the accumulator
  • |`o`|output the value of the accumulator as a number
  • If, after executing a command, the accumulator is equal to -1 or equal to 256, the accumulator must be reset to zero.
  • ## I/O
  • Input can be taken as a single string, list of codepoints, or any other reasonable format. It is guaranteed that the input will only consist of deadfish commands.
  • Output can be given as an array of numbers, or just the numbers printed with separators between them.
  • ## Testcases
  • (some are borrowed from the [Esolangs wiki](https://esolangs.org/wiki/Deadfish#Mandatory_test_cases))
  • ```
  • iissso -> 0
  • diissisdo -> 288
  • iissisdddddddddddddddddddddddddddddddddo -> 0
  • isssoisoisoisoiso -> 1,4,25,676,458329
  • ooooosioiiisooo -> 0,0,0,0,0,1,16,16,16
  • iiii -> nothing
  • iiiiiiiissdiiiiiiiiiiiiiiiiio -> 4112
  • o -> 0
  • ```
  • [Without Outputs](https://dzaima.github.io/paste#0y8wsLi7O50rJBNKZxSn5XFAGIQBUCNKYiYS48kGgODM/E2gGkAUA)
#1: Initial revision by user avatar Razetime‭ · 2021-01-30T16:53:01Z (almost 4 years ago)
Write a Deadfish Interpreter
*A rewrite of [this SE question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*

## Challenge

Deadfish uses a single accumulator, on which all commands are to be performed.

It has the following commands:

|Command|Description
|-|-
|`i`|increment the accumulator
|`d`|decrement the accumulator
|`s`|square the value of the accumulator
|`o`|output the value of the accumulator as a number

If, after executing a command, the accumulator is equal to -1 or equal to 256, the accumulator must be reset to zero.

## I/O
Input can be taken as a single string, list of codepoints, or any other reasonable format. It is guaranteed that the input will only consist of deadfish commands.

Output can be given as an array of numbers, or just the numbers printed with separators between them.

## Testcases
(some are borrowed from the [Esolangs wiki](https://esolangs.org/wiki/Deadfish#Mandatory_test_cases))
```
iissso -> 0
diissisdo -> 288
iissisdddddddddddddddddddddddddddddddddo -> 0
isssoisoisoisoiso -> 1,4,25,676,458329
ooooosioiiisooo -> 0,0,0,0,0,1,16,16,16
```
[Without Outputs](https://dzaima.github.io/paste#0y8wsLi7O50rJBNKZxSn5XFAGIQBUCNKYiYS48kGgODM/E2gGkAUA)