Deadfish
- This is a featured language.
- Not to be confused with Deadfih.
Deadfish is a very odd interpreted programming language created by Jonathan Todd Skinner. It was released under public domain and was originally programmed in C, but has since been ported to many other programming languages (see below).
Deadfish has a way to output things but it has no way to input them! It only has a few commands, only four in total. It is also case-sensitive, and can deal only with integer values when adding or subtracting, however once squared this number increases greatly!
You can have several commands per line, at least in the C implementation.
Errors are not acknowledged: the shell simply adds a newline character!
Anything that is not a command is not accepted by the interpreter. As you've probably assumed deadfish was created in less than a hour, and can be very useful in creating highly interactive programs.
Commands
Increment | Decrement | Square | Output | Halt (optional) | |
---|---|---|---|---|---|
Standard Deadfish | i |
d |
s |
o |
h
|
XKCD variation | x |
d |
k |
c
| |
f() variation | f |
f() |
f () |
f(())
| |
F!-- variation | F! |
U! |
C! |
K!
| |
嘭!哐!叮!呲!咣! variation | 嘭! |
哐! |
叮! |
呲!
| |
Sakana variation | 増 |
減 |
乗 |
出 |
停
|
ΙΧΘΥΣ variation | ι |
χ |
θ |
υ
| |
Numbered DeadFish | 1 |
2 |
3 |
4 |
5
|
Sometimes, the additional command 'h', meaning halt, is used.
Although the comment in the C implementation states /* Make sure x is not greater then [sic] 256 */
, the implementation sets the value to zero if and only if value == -1 || value == 256
.
Why "deadfish"?
Deadfish started out as a subset of HQ9+, as all it would do would be to print out hello world and give an iou depending on how many times the command 9 was entered for how many 99 bottles of beer programs it owed the programmer. Deadfish was originally going to be called fishheads as programming in this language is like eating raw fish heads. However, due to the limiting features of the language, programming in this language became like eating (and having to smell) dead, rotting fish heads, an experience not often generally considered pleasurable.
Example programs
Note: the standard shell adds >> characters for readability.
>> i >> >> o 1 >> d
This program prints the ASCII values (as numbers, not characters, since Deadfish does not have character output) of the characters in the string "Hello, world!"
iiisdsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiooiiio dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddo dddddddddddddddddddddsddoddddddddoiiioddddddoddddddddo dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddo
Mandatory test cases
Since the proper behavior of Deadfish arithmetic can be *cough* surprising, here are a few important test cases for people making interpreters: The program
iissso
should print 0; the program
diissisdo
should print 288; and the program
iissisdddddddddddddddddddddddddddddddddo
should print 0.
Interpreters that do not support these test cases and cannot trivially be fixed may be removed from the implementations subpages. In particular, it is required to support numbers at least up to 17^2 == 289
to showcase the strange behavior also of the s
command.
Implementations
Deadfish has been implemented in a very wide range of languages – it is something of a popular problem for demonstrating the capabilities of a new language, or simply as a fun exercise to implement.
Due to its length, the list of implementations has been split out into subpages:
Variants of deadfish
- Deadfish i object oriented
- Deadfish~ superset
- FISHQ9+ — deadfish merged with HQ9+
- Deadfish x — xkcd variant with extra commands
- Print "deadfish" includes termination, and character printing.
- Deadfish 2 is another superset.
- Functional deadfish adds "functions"
- ΙΧΘΥΣ ancient Greek themed, with Unicode output, statement definitions, and Turing-complete via Deadfish-overflow side-effects.
- Livefish Input only variant
- CARfish tries to make programming in Deadfish even more horrible.
- Deadfish "self-interpreter" is a Deadfish superset that is capable of implementing Deadfish without explicit Deadfish-implementing commands.
- BrainfisHQ9+ merges deadfish with Brainfuck and HQ9+
- 2Deadfish makes each command in Deadfish change the direction of the pointer by some multiple of 90 degrees.
- Catshark, which also has 4 instructions, but are modified to support 2 accumulators.
- Deadsocket has the
s
instruction modified to open a socket. - Deadfish++ with more commands and custom functions. Turing-complete.
- Feedfish is a Deadfish derivative that simulates feeding a fish.
- ><x> is a crossbreed between deadfish and ><>.
See also
- Deadfish/Constants - Shortest ways to produce numbers in the range 0 to 255.
External resources
- Creator's Webpage (from the Wayback Machine; retrieved on 8 February 2011) (Note: The creator's webpage was added for more information about the creator of the language.)
- Deadfish at Planet Source Code
- This is an implementation of Deadfish for the Commodore 64 (from the Wayback Machine; retrieved on 21 August 2010)
- Anarchy golf Deadfish challenge
- Implementation of Deadfish in Nintendo Family Computer
- Implementation on the Makey-Makey
- Deadfish implementation for Pebble watches