Sqrt(x)

From Esolang
Jump to navigation Jump to search

Sqrt(x) may be one of the hardest esolangs.

Introduction

User:Why027 made this language on 21th century's Square day, in an attempt to make the hardest esolang. Sqrt(x) is a Cell-based one-dimensional esoteric programming language.

Why did he try to make it, We do not know.

brainfuck
Paradigm(s) imperative
Designed by User:Why027
Appeared in 2025
Memory system Cell-based
Dimensions one-dimensional
Computational class Turing complete
Reference implementation Unimplemented
Influenced by Brainfuck
Malbolge

Overview

Sqrt(x) operates on an array of memory cells, each initially set to zero. There is a pointer, initially pointing to the first memory cell. Also there is a counter of sorts which starts at 0 in the beginning of the line (originally it was the program, but User:Why027 made it easier). After each command it increments the counter by 1, but if the counter reaches 10 is resets it back to zero. A cell has a minimum (0) and a maximum (255) When it runs a line of code (without halt number) it does this:

Sqrt(0,4733715204) ->

c=0,68802 ->

ADD_TO(Formatted_code; {c[0]-0*10^(6-(0+1))}) -> ... -> ADD_TO(Formatted_code; {c[5]-0*10^(6-(5+1))}) ->

RUN{Formatted_code; scrambled?=0; shift?=0}


This would be a cat program : 0.4733715204 Without the scrambling and shifting : 056457


If it hits a non-command it skips it and doesn't increment the counter.

When it compiles the program you made which may look like this:

2?3025

Then it takes the square root of the number after the ?:

2?55

Afterwards it shifts the numbers back:

2?54

Which it reads it as halt after command 2, do command 5, after that do command 4. Which is a program which takes in a input then outputs it.


The commands for the unscrambled and non-command shifting version are as followed:

Command Description
0 noop
1 Move the pointer to the right
2 Increment the memory cell at the pointer and do the crazy operation to the cell after the pointer
3 Decrement the memory cell at the pointer and increment by 1 the cell before the pointer
4 Output the character signified by the cell at the pointer using ASCII
5 Input a character and store it in the cell at the pointer using ASCII
6 Jump past the matching 7 if the cell at the pointer is 0
7 Jump back to the matching 6 if the cell at the pointer is nonzero
8 Does the crazy operation to the cell at the pointer
9 Move the pointer to the left

Also, here is the crazy operation:

C%2
0 1
S%2 0 1 0
1 0 1

Where S is the Sum of both cell next to the cell at the pointer.

Where C is the Cell at the pointer.

Examples

There are no examples yet, exept the ones in Overview. So don't expect much in the future.