WCDA

From Esolang
Jump to: navigation, search

WCDA (We Can Do Anything) is a golfing esoteric programming language made by User:HereToAnnoy. The specifics of the language are constantly changing, so it is hard to have an accurate description of all of its abilities. WCDA is built on the idea that it is community based; people can add whatever they want to it.

WCDA's command list is stored on User:HereToAnnoy's google drive at this page. The command list currently only supports the official Node.js interpreter (but may support other languages in the future, who knows).

Commands/instructions

WCDA programs (saved as a .wcda) are made of several (hopefully not many, as it is a golfing language) one character commands. Commands can be made of any Unicode symbol. To add a command, one must comment a request for the command to be added, and the editors of the spreadsheet will add it if they see fit.
Commands in WCDA can use any Node.js module (which will be installed to the interpreter), but they must not be too specific. A general rule of thumb for whether or not something needs to be added as a command is the following:

  • If a program can not be created using a reasonable amount of commands, more commands should be added to reduce the program size.
  • If a program is impossible to be created in WCDA (User:HereToAnnoy believes this is an impossible scenario, however), add commands until it is possible.
  • If a program can already be created using a small amount of commands, there is no need to optimize it any more.

Execution

Execution of a WCDA program is determined by an instruction pointer, which may be modified by commands in the program. The program may also modify the distance that the instruction pointer moves after every command, which is by default 1 character.

Computational class

WCDA can interpret JavaScript and run any code possible in Node.js (see examples), so it must have the same computational class. Correct User:HereToAnnoy if he's wrong, but he has been told that JavaScript is turing complete. Thus, WCDA is turing complete.

Example programs

Note: These examples may become outdated. If an example is not working or optimizable, please update it.

JavaScript interpreter (6 bytes)

S"IJ1j

How it works:

  • S - Sets the stack variable to an empty array
  • " - Sets the string variable to an empty string
  • I - Receives one line of input and stores it in the string variable
  • J - Executes the string variable as JavaScript code
  • 1 - Pushes 1 to the stack
  • j - Pops POS, jumps to POS (in this case jumps back to the " instruction)

In the official WCDA interpreter, it is possible to exit this program by typing "running=false" into the input prompt.

Full-line cat program (3 bytes)

"IO

How it works:

  • O - Prints the string variable to the console

Hello, World! (21 bytes)

"“Hello, World!”O

How it works:

  • “ - Reads the program until a ” and appends the in between string to the string variable.
  • Hello, World! - is not executed

Execute any JavaScript (n+8 bytes)

"“INSERT JAVASCRIPT HERE”J

Note: This example works as long as the ” symbol (end quote symbol, normal quotes are fine) is not used in the JavaScript code.
This example can use the ” symbol in the JavaScript code (n+22 bytes), not that you'd really want to.

S"“INSERT JAVASCRIPT UP UNTIL END QUOTE”p”‘“JAVASCRIPT AFTER END QUOTE”J

How it works:

  • p - Pushes the codepoint of the next character to the stack and skips it
  • ‘ - Pops A, appends the Unicode symbol corresponding to A (A is a code point) to the str variable.

Cheated 99 bottles of beer on the wall (276 bytes)

S"pc:'“ bottle(s) of beer on the wall,”O":'“ bottle(s) of beer.
Take one down, pass it around,”O"1\-:'“ bottle(s) of beer on the wall.”O":4\0≠“0 bottles of beer on the wall,
0 bottles of beer,
Go to the store, buy some more,
99 bottles of beer on the wall.”O

How it works:

  •  : - Duplicate the top element of the stack
  • 0-9 - Push a decimal value on the stack
  • \ - Swaps the top two elements of the stack
  • ≠ - Pops A, B, and POS. If A ≠ B, it will jump to POS. Else, it will continue executing from the same spot.
  • - - Pops A,B, pushes A-B.
  • ' - Pops A, appends A to str variable as a number (i.e S"5'O will output 5, not a control character)
  • Note: The newlines in the program are a part of the strings. Do not forget them.

External resources