From Esolang
Jump to navigation Jump to search

Sploosh (Splattered Operation Oriented Scripting Host) is a programming language created by User:Star651 in September 2020. The syntax appears to be fairly conventional, but a Sploosh interpreter or compiler handles the code in an unconventional way. Some may even call Sploosh a dialect of JavaScript, Python, or other interpreted languages, but the way the compiler handles data gives its esolang status away.

How Sploosh is different from non-esoteric programming languages

Strings are always estimated. For example, if the first letter of a string is a letter between capital A and J, the compiler will pick a random letter between capital A and J ten times; if one of these ten is the actual first letter of the string, the letter will remain the first letter of the string. If the letter is never guessed, the last letter guessed will become the first letter of the string. This random letter guessing is done on every letter in the string. Punctuation marks also have guesses performed on them, depending where they are in the ASCII table. For example, punctuation marks that are between ASCII 33 and 47 (exclamation mark, ampersand, dollar sign, number sign, etc.), if found in a string, will trigger ten random symbols between ASCII values 33 and 47 to be generated. If one of these symbols was the original symbol typed in the code, it will be the symbol in the output. If this symbol is not guessed, then the symbol from the tenth guess is outputted. Symbols between 48 and 57 (the numbers zero through nine) are treated the same way. Symbols 58 through 64 (colon, equals, at sign, etc.) are in their own category; of course 65 through 74 (capital A through J), 75 through 84 (K through T), and 85 through 90 (U through Z) are separate categories, 97 through 106 (lowercase a through j), 107 through 116 (k through t), and 117 through 122 (u through z) are their own separate categories, 91 through 96 (backslash, caret, etc.) are in their own category, 123 through 127 (vertical bar, tilde, etc.) are in their own category, but the largest category is 128 through 255, so texts that contain these symbols are more likely to have random symbols due to the computer making ten guesses between 128 and 255, so good luck getting the "ñ" in the word "piñata" (ASCII value 164), while these other ranges are smaller, so wrong symbols from the random guesses are still likely but not as random as the extended ASCII range. Space characters are also guessed, but from a much smaller range; if a 32 (space), 13 (newline) 10 (automatic line break without pressing Return), 9 (tab) or 8 (backspace) are found, then the interpreter will guess ten times from a set involving just these five ASCII characters; as usual, if one of these guesses is the actual character typed, then the character will be the one used in the output, otherwise the tenth guess is used, so on the off chance that a 32 (space) is not guessed, perhaps it will be replaced with a 13 (newline) or 9 (tab), who knows.

Integers are also subject to random guessing. Ten random 0 through 9 guesses are thrown out for every digit of the number. As with strings, if one of these guesses matches the digit, then this becomes the digit in the output; if that digit is never guessed after ten guesses, the tenth guess is used. Also, for every use of a basic mathematical operation (+-*/), ten guesses are made using these four operations, so if you write 5+5 and the number guesser guesses a 5 both times, but the operator guessor never picks + and picks / on the final guess, then you will end up with 5/5. Some interpreters may do the same thing for more advanced operations, such as guessing between square root, cube root, fourth root, fifth root and sixth root and making ten guesses with these.

Floating point numbers have the 0 through 9 guess for every individual digit, much like integers.

Booleans are subject to ten random guesses just for an odd probability trick. If you write a boolean that says false, ten random boolean guesses will be made, and if any one of them is false, then the value will indeed be false. However, if the stars align just right and all ten guesses are true, then that tenth guess is used. But there is a 99.999% chance that the boolean you intended will be used, since a boolean guess is a 50/50 chance, most likely if you say a value is true, one of the interpreter's guesses will be true and it can stop guessing.

Arrays are subject to ten random guesses using the integer that is the length property of the array, so if the array's length is between 0 and 9, ten guesses are made; if one of these guesses is equal to the actual length according to the program, then this will be the true length of the array. If not, the tenth guess will be used, which can result in specified elements being removed from the array if said tenth guess is lower than the number of elements specified in the array, or generic empty elements being added if the guessed number is higher.

Objects are transformed into arrays (so you can index the same object using both object.property or array[number] syntax), and they are treated how arrays are treated.

The way for and while loops are treated is equally unpredictable due to the way integers are treated.

if statements are also unpredictable, because numbers, strings, etc. that follow a comparison operator such as ==, !=, <=, >=, < and > are still subject to the ten guess rule. So if you have a statement like this: if(x==0) Ten random numbers will be picked between 0 and 9. If one of them actually is the value specified in the code, the guessing will stop, but if it isn't, then the last guess is used, so if that last guess is 7, then it has internally changed to if(x==7)

If you have conjunction operators such as && (and) and || (or), there is a guessing process that makes ten guesses from all the conjunction operators. Given how few conjunctions there are, most likely, the one that you intended will be used.

Hello World example (or Jello Woqld, or Fello Wollf, or many other unpredictable results)

print("Hello World!") /* This code goes through each character of a string that says "Hello World!" For each character, including the space, ten guesses are made. Due to ten guesses being made within a range of ten characters, it is likely that the proper character will be guessed therefore causing the guessing process to stop, but if the interpreter checks the H, and its ten guesses are F, G, A, B, I, J, I, B, A and G, then a G will be used instead of an H, since no H was guessed. But if it guesses an H on the fourth guess, it will stop guessing, output the H and do the same process for the next character, and so on through the entire string. */

Some looping and array examples

for(i=0; i<100; i++){ /* Start a loop where counter variable i is most likely equal to 0, but ten guesses are made; if one of these guesses is 0, then i will be equal to 0, but if none of these guesses are 0 and the final guess is 9, then i will be equal to 9. The loop will continue while the i<100 condition is true (unless the boolean guess process just happens to guess ten falses in a row, then it will continue while i<100 is false and cut off before it gets going). */ print(myArray[i]) } /* Print the data stored in myArray, or at least try. For each execution of the loop, the number is guessed ten times, so myArray[i] will start out as a guess between 0 myArray[0] and myArray[9], if the proper number is not guessed, it can either skip some of the executions in the loop, or stay in the loop longer; for example, if you're in the 9th iteration of the loop and the guesser doesn't guess 9 and the final guess is 0, then you just ended up at the beginning of the loop. Yet, if you're at execution number 11, the guessing process never guesses 11 but the final guess is 19, then you just skipped some executions. */