Chance

From Esolang
Jump to navigation Jump to search
Chance
Paradigm(s) imperative
Designed by User:M654
Appeared in 2016
Memory system tape-based
Computational class Unknown
Reference implementation Chance
File extension(s) .ch

Chance is an esoteric programming language made in 2016 by m654 with the goal of being as hard as possible to write programs in. Chance is heavily based on chance. In fact, there is a 14% chance that a cat program written in Chance will work.

Commands in chance are grouped into 4 groups: navigation, addition/subtraction, output and input. Each command in a group has a 1 in 3 chance of running correctly. If it does run correctly, there is a 1 in 2 chance that it will do what you want. For example, the + command has a 1 in 3 chance of running, and on top of that, there is a 1 in 2 chance of it either adding one to the selected cell's value, or subtracting one.

Instructions

Chance has 12 instructions.

Command Info
>, /, ö Move up/down the tape
+, \, ä Add/subtract one from the selected cell
!, %, { Output the selected cell's value
i, @, ^ Get input and store it in the selected cell

Examples

Hello, world!

This has a 0.000043% chance of running, which effectively means it will never run.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>++++++++++++++++++++++++++++++++++++++++++++!>++++++++++++++++++++++++++++++++!>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!>+++++++++++++++++++++++++++++++++

Cat program

The cat program is Chance is created by combining one command in the input group and another in the output group.

This program has a 14% chance of running.

i!
Cat variations

There are 27 variations of the cat program, which all have a 14% chance of running.

Implementations

Interpreter Written in Perl here