Collatz Multiverse

From Esolang
Jump to navigation Jump to search

The Collatz Conjecture suggests that if you take any number, and apply the rules that if it's odd, you multiply it by 3 and add 1, and if it's even, divide it by 2, you eventually get stuck in a 4-2-1-4-2-1 loop. The Collatz Multiverse is the concept that instead of ding 3x+1, you do ax+b, where a and b are whatever you want. And 5anz (talk)'m here to make an Esolang out of it.

Syntax

I intend on making this a OISC, which from my understanding, only has 1 function (I could be wrong?), so here's the function:

[var1] = [var2] x + [var3], [bool] PRINT.

Yeah OISC's get pretty weird, so I think I might have to elaborate a bit.

If var1 is odd, its value is multiplied by var2 and added to var3, and because it's the Collatz Conjecture, if var1 was divisible by 2, it gets halved instead. As an example, if var1 is 7, var2 is 3, and var3 is 1, running the above function twice would make var1s get set to 22 (7*3+1), and then 11 (22/2). Also, no numbers, var = 3 x + 1 is an invalid line (even ignoring print stuff).

Note: To allow things to be actually done here, 0 is treated like an odd number.

The Boolean decides weather or not the corresponding character then gets printed, but it uses DO and NOT instead of TRUE and FALSE or YES and NO, and these are the only things it can be. for example, if var1s value is 110, and the Boolean says DO, an A will be printed to the screen, but if it says NOT, it won't.

Variables

Variables may only be only letters, numbers, and underscore, and are automatically initialized at 0.

Arrays

You can also do arrays, they look like arr[var], arr can also be used as a variable, but it acts like arr[0], ignoring the fact that you still aren't allowed to just use numbers.

Special Variables

There are also some special variables that are different to any other variable in some way.

Variable Purpose
negativeOne Initializes at -1 instead of 0.
lineNumber Refers to the instruction pointers location, changing it moves it to that line number, but doesn't execute it. Line numbers start indexing at 1.
input Takes input, and uses that as a variable, cannot be redefined.

Turing Class

I'm pretty sure this is Turing complete, though I'm still not entirely sure (I'm pretty confident though).