From Esolang
Jump to: navigation, search


Losescript is a programming language that certainly makes you win in some golf contests(while if the questions change even if a bit, you will certainly lose).



The 9 command does the thing below:

A 99 bottles of beer program is a program solving the popular problem of "singing" the song "99 Bottles of Beer", which goes something like this: 99 bottles of beer on the wall, 99 bottles of beer. Take one down, pass it around, 98 bottles of beer on the wall. 98 bottles of beer on the wall, 98 bottles of beer. Take one down, pass it around, 97 bottles of beer on the wall. ... 1 bottle of beer on the wall, 1 bottle of beer. Take one down, pass it around, No bottles of beer on the wall. There are, of course, several variations on the song and/or the program. Some variants include the following final verse: No bottles of beer on the wall, No bottles of beer. Go to the store, buy some more, 99 bottles of beer on the wall. Some versions ignore the singular form of "bottle" in the case of 1 bottle, using simply "bottle(s)" everywhere instead. Some display the numeral 0 instead of the word "No" for the final count of bottles. These tactics are considered cheating by some, but are nevertheless quite common. Purpose 99 Bottles of Beer is often one of the first programs to be written in a new esoteric programming language, to demonstrate that it can loop and halt under a certain condition. While suggestive that the language is "usable for computation", it does not constitute a proof that it is Turing-complete.


It does the Achermann function below:

Ackermann function

Jump to: navigation, search The Ackermann function is probably the most well-known example of a function that is computable but which grows so extremely fast that it is not primitive recursive. Thus being able to calculate it is a test of the computational class of a language. It is a function of two natural numbers, returning a natural number. Its definition is by recursion in two variables: int A(int m,int n) {

 if (m==0) { return n+1; }
 else if (n==0) { return A(m-1,1); }
 else { return A(m-1,A(m,n-1)); }



It does the thing below:


Jump to: navigation, search A Bigot (or bigotous program) is an extension of a Narcissist. It is a program (or Turing machine encoding) that decides the following language: The set of programs (or encodings of TMs) that decide this language. In other words, it only accepts programs that are just like itself. This concept was independently dreamed up by David Rutter (User:Quintopia) in 2010 as a natural generalization of the Narcissist concept. Notice that a Bigot is not a Narcissist, as Narcissists only accept their own listing. A Bigot also accepts its own listing, but many other programs besides. Let us call the set of Bigots a particular Bigot accepts its class, since they define an equivalence class under the relation "accepts the same language." Since a program that accepts such a language can contain any number of null operations, the language will be infinite in size. However, we have no reason to believe there is only one such language. Indeed, there may be infinitely many. In general, it will most likely depend on the computational class of the language one is working with. Note that the existence of such a program is impossible in any Turing-complete language, as this would contradict Rice's theorem. So, an open question is this: What is the maximum computational power a language can have, and still admit a bigotous program?


It does the translation below:

Binary to unary conversion

Jump to: navigation, search A binary to unary conversion program is a program that can convert a given number in binary form to a unary form. It is mainly used to showcase Markov algorithm (wikipedia). Its steps are as follows: Replace all instances of 1 with 0* (* can be any character) Replace all instances of *0 with 0** Remove all instances of 0 For example, here is the conversion of 1001 to *********: 1001: 1001 -> 0*000* 0*000*: 0*000* -> 00**00* 00**00* -> 00*0**0* 00*0**0* -> 000***0*** 000***0*** -> 000**0***** 000**0***** -> 000*0******* 000*0******* -> 0000********* 0000********* -> ********* Contents [hide] 1 Examples in programming languages 1.1 /// 1.2 Retina 1.3 Sed Examples in programming languages /// /1/0*//*0/0**//0//100010 Retina 1 0* +`\*0 0** 0 (an extra line must be present) Try it online. Sed s/1/0*/g;:x;s/\*0/0**/g;tx;s/0//g


It makes a CAT program.

Cat program

Jump to: navigation, search The cat program is a program that copies its standard input to its standard output. It is named after the Unix command cat, although this command is actually more powerful. The cat program is a popular problem. cat has also been described humorously as a programming language in which every program is a quine. The programming language is obviously of very limited computational usefulness. See HQ9+ and Text. Hello world and quine program

  1. !/usr/bin/cat

Hello, world! You must chmod +x the program file to make it executable: $ chmod +x file To execute it: $ ./file (assuming file is the filename of the program) Reverse cat Other shell commands could be used in similar way, so there is reverse variant of cat language too. It's called rev:

  1. !/usr/bin/rev

!dlrow ,olleH


It prints the Collatz sequence:

Collatz sequence

Jump to: navigation, search The Collatz sequence, also called the Hailstone sequence, is a sequence of numbers relevant to the Collatz conjecture, which theorizes that any number using this algorithm will eventually be reduced to 1. The conjecture's truth is supported by calculations, but it hasn't yet been proved that no number can indefinitely stay above 1. Contents [hide] 1 Formal definition 2 Pseudocode Example 3 Example of a Collatz sequence 4 See also 5 External resources Formal definition To get a Collatz sequence from a number, if it's even, divide it by two, and if it's odd, multiply it by three and add one. Continue the operation on the result of the previous operation until the number becomes 1. Pseudocode Example

function collatz(n)
while n > 1
  show n
  if n is odd then
    set n = 3n + 1
    set n = n / 2
show n

Example of a Collatz sequence Collatz sequence of 25: 25 76 38 19 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1


It makes a compiler.(To Brainfuck)


It compiles Deadfish.


It makes a digital root calculator.


It prints the Fibonacci sequence.


It prints"Hello,world".


It makes an interpreter for Brainfuck.


It makes an iterating quine.(From Losescript to C then to Losescript)


It creates a Narcissist program.


This creates a syntax error, because the program should be null when interpreted.


This makes the program errored, only if the program isn't "PAP".


This command is certainly non-syntax-errored in Brainfuck.It is another No-op.


Does nothing(No-op). It already olves the popular problems.


It prints its source code. Just another cheating quine.


Makes a ROT-13 encoder/decoder. It determines on input.


The 'S' command is already a symmetric program.


Make a Truth-machine.


Yes! It is undoubted Turing-Complete, since it interprets Brainfuck, which is a Turing-Tarpit. You must understand that you will also lose when interpreting it.