Wizzcake+

From Esolang
Jump to navigation Jump to search

Wizzcake+ was created by user:RainbowDash on March 18th 2024. Wizzcake+ is a upgraded version of Wizzcake which adds functions from brainfuck making it Turing complete. Wizzcake+ contains 1 stack, a pointer, and an infinite array of cells.

Every single word in a given text, gibberish or not preforms 10 different instructions, multiple different times.

The mascot of Wizzcake+,it is still a rat cupcake


Instructions

The Base Instructions

  • Putting in the characters [ or ] by themselves will create a loop like in brainfuck.
  • Putting "," like in brainfuck will allow you to input a given string from assci into the cells, fowards of the pointer
  • Move pointer right
  • Move pointer left
  • Increment pointer cell
  • Decrement pointer cell
  • Print out pointer cell
  • Print out pointer cell ASCII
  • Pop stack
  • Push cell to stack
  • Clear cell
  • Pop stack ASCII

Useful found commands

Some of these found commands have consequences such as moving the cursor left when you don't want to move it left. The good thing is that if you do in fact start at cell 0 so moving left will keep you at cell 0.

  • fork - Moves pointer left
  • right - Moves pointer right
  • added - Increments the pointer cell and then prints it out
  • his - Clears the current cell
  • give - Adds plus 2 to the cell and moves left
  • e - Add plus 1 without printing it
  • addanation - Prints out the pointer cell + 1 in assci

Example Programs

Hello world program in Wizzcake+

right e give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give addanation his
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give addanation his right e give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give addanation his right e give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give addanation his give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give addanation his right e give give give give give give give give give give give
give give give give addanation his give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give addanation his give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give addanation his right e give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give addanation his right e give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give addanation his right e give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give give give give
give give give give give give give give give give give give give give give give give addanation his
give give give give give give give give give give give give give give give give addanation his

With this Javascript code you can generate a program to print out mostly any string

for (const char of "Hello world!") {
    const ascii = char.charCodeAt(0);
    if (ascii % 2 === 0) {
        console.log("right e " + "give ".repeat((char.charCodeAt(0))/2-1) + "addanation his ");
    } else {
        console.log("give ".repeat((char.charCodeAt(0))/2) + "addanation his ");
    }
}

Interpreter in JavaScript

function wizzcakep(inputPrgm){
    // Usage
    let words = inputPrgm.toUpperCase().split(" ");
    let cells = [0]; // Initalize cells
    let stack = [];
    let cursorPos = 0 // Set pointer
    let i = 0;
    while (i < words.length) {
        let word = words[i];
        if(word != "[" && word != "]" && word != ","){
            i++
            let hash = 0;
            for (let j = 0; j < word.length; j++) {
                hash = (hash << 5) - hash + word.charCodeAt(j);
                hash |= 0; // Convert to 32-bit integer
            }
            let seed = Math.abs(hash) / Math.pow(2, 31); // Unique number generated for every word
            if (word.length === 1) {
                seed = (word.charCodeAt(0) * 2654435761) % Math.pow(2, 31);
            }
            var x = Math.sin(seed) * 10000;
            var outputSeed = x - Math.floor(x);
            var amountOfLoops = Math.round(outputSeed * 5)+1;
            for (let i = 0; i < amountOfLoops; i++) {
                outputSeed = seed;
                x = Math.sin(outputSeed) * 10000;
                outputSeed = x - Math.floor(x);
                let instruction = Math.round(outputSeed * 9)+1;
                switch(instruction) {
                    case 1: // Move pointer right
                        cursorPos += 1 
                    break;
                    case 2: // Move pointer left
                        cursorPos -= 1 
                    break;
                    case 3: // Increment pointer cell
                        cells[cursorPos] = (cells[cursorPos] || 0) + 1;
                    break;
                    case 4: // Decrement pointer cell
                        cells[cursorPos] = Math.max(((cells[cursorPos] || 0) - 1),0);
                    break;
                    case 5: // Print out pointer cell
                        console.log(cells[cursorPos] ?? 0);
                    break;
                    case 6: // Print out pointer cell ASCII
                        console.log(String.fromCharCode(cells[cursorPos] ?? 0));
                    break;
                    case 7: // Pop stack
                        if (stack.length > 0){
                            console.log(stack.join(" "));
                            stack = [];
                        }
                    break;
                    case 8: // Push cell to stack
                        stack.push(cells[cursorPos]);
                        cells[cursorPos] = 0;
                    break;
                    case 9: // Clear cell
                        cells[cursorPos] = 0;
                    break;
                    case 10: //Pop stack ASCII
                        if (stack.length > 0){
                            stack.forEach(number => {
                                console.log(String.fromCharCode(number));
                            });
                            stack = [];
                        }
                    break;
                }
                seed++;
            }
        } else {
          if(word == ","){
            var input = prompt("");
            var inputASSCI = input.split('');
            for (let h = 0; h < inputASSCI.length; h++) {
                 cells[cursorPos] = (inputASSCI[h].charCodeAt(0));
                 cursorPos += 1 
            }
            cursorPos -= 1
            i++
          } else if (word == "]") {
            if ((cells[cursorPos] || 0) <= 0) {
                i++; // Move to the next instruction
            } else {
                let loopDepth = 1;
                while (loopDepth > 0) {
                    i--; // Move back to find the matching [
                    if (words[i] === "]") {
                        loopDepth++;
                    } else if (words[i] === "[") {
                        loopDepth--;
                    }
                }
            }
          } else { i++ }
        }
    }
}