wsad
Jump to navigation
Jump to search
- This esolang is a brainfuck derivative.
wsad (say /wˈsæd/) is a brainfuck derivative, that uses only 4 characters.
Commands
Every command consists of two characters in w, s, a, d
, for example: wa
is equivalent to the [
command in brainfuck.
It is case insensitive.
First character\Second character | w | s | a | d |
---|---|---|---|---|
w | brainfuck + | brainfuck - | brainfuck [ | brainfuck ] |
s | brainfuck , | brainfuck . | brainfuck < | brainfuck > |
a | Input an integer and store it in current cell | Output current cell as integer | If current cell is not 0, jump to the matching ad |
If current cell is 0, jump to the matching aa
|
d | Halt | Set current cell to random integer in 0-255 | Break a loop (by aa and ad or wa and wd ) |
Jump to the start of program |
Examples
Truth Machine
awaswaaswd
Cat program (never terminates)
swssdd
Hello World
It is just translated from brainfuck.
wwwwwwwwwwwwwwwwwasdwwwwwwwwwasdwwwwsdwwwwwwsdwwwwwwsdwwsasasasawswdsdwwsdwwsdwssdsdwwwasawdsawswdsdsdsssdwswswssswwwwwwwwwwwwwwsssswwwwwwsssdsdsssawssssasswwwwwwsswswswswswswssswswswswswswswswssssdsdwwsssdwwwwss
XKCD Random Number
wwwwwwwwas
Random uppercase letter
It is just translated from Random Brainfuck.
sddssdsdwwwwwwwwwwwasawwwwwwwwwwsdwswdsawwsawasdwssdwwsawasdwdsdwasawwsdwswdsasawasawdsdwswdsdsdsdwwwwwwwwwwwwwwwwwasawwwwwwwwwwwwwwwwsdwswdsawwss
Infinite loop
aaad
or simply:
dd
Turing completeness
Since it has all the commands in brainfuck, wsad is Turing complete.
Interpreter
- Official interpreter in C++, an error (an unmatched bracket, using a break outside a loop, accessing cells outside the tape) is not ckecked, so it causes undefined behavior, use
!
to separate program and input