Wizzcake

From Esolang
Jump to navigation Jump to search

Wizzcake is created by user:RainbowDash. Wizzcake contains 1 register, and 1 stack. Every single word in a given text, gibberish or not preforms 7 different instructions, multiple different times.

The mascot of Wizzcake,yes it is a rat cupcake


Instructions

The instructions

  • Pop stack
  • Set reg to number
  • Push reg to stack
  • Add number to reg (Used to be "in" wizzcake but is now removed due to a bug that if fixed ruins previous programs)
  • Subtract number from reg
  • Clear reg
  • Clear stack
  • Pop stack but in ASCII letters

Useful found commands

  • Foxy - Pop stack once
  • Sus - Push the register to the stack then pop the stack in ASCII letters
  • I - Clear the reg and stack

Example Programs

This program does not output Hello world, it only outputs the number -2887711.

Hello world

This program prints out a 5x5 list of 0's

i a fault among i a fault among i a fault among i a fault among i a fault among

This JavaScript program made by user:Salpynx outputs a given Unicode character

i = 1;  // this is the count for how many times to repeat for the target char
a = -4889132; // "baka " does this to the reg
while (String.fromCharCode(Math.abs(a*i)*0.0149878) != "ඞ") { i += 1}

wizzcake("baka ".repeat(i) + "sus");

Interpreter in JavaScript

function wizzcake(inputPrgm){
    // Usage
    let reg = 0;
    let stack = [];
    let words = inputPrgm.toUpperCase().split(" ");
    for (let i = 0; i < words.length; i++) {
        let word = words[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 * 8)+1;
            switch(instruction) {
                case 2: // Pop stack
                    if (stack.length > 0){
                        console.log(stack.join(" "));
                        stack = [];
                    }
                break;
                case 3: // Set reg to number
                    var newRandom = Math.sin(outputSeed * 10000) * 10000;
                    reg = Math.round((newRandom - (Math.floor(newRandom)))*10000000);
                break;
                case 4: // Push reg to stack
                    stack.push(reg);
                    reg = 0;
                break
                case 5: // Subtract number from reg
                    var newRandom = Math.sin(outputSeed * 10000) * 10000;
                    reg -= Math.round((newRandom - (Math.floor(newRandom)))*10000000);
                break
                case 6: // Clear reg
                    reg = 0;
                break
                case 7: // Clear stack
                    stack = [];
                break
                case 8: //Pop stack but in ASCII letters
                    if (stack.length > 0){
                        stack.forEach(number => {
                            console.log(String.fromCharCode(Math.abs(number)*0.0149878));
                        });
                        stack = [];
                    }
                break;
            }
            seed++;
        }
    }
}