From a0395254b1ad41f2840758d5142e1723304d27ef Mon Sep 17 00:00:00 2001 From: sneedgroup-holder Date: Tue, 17 Dec 2024 10:30:00 -0600 Subject: [PATCH] Update jspp.js --- jspp.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/jspp.js b/jspp.js index 7ae4457..4843c7b 100644 --- a/jspp.js +++ b/jspp.js @@ -3,11 +3,6 @@ // Now Maintained by Sneed Group // Licensed under Sammy Public License with <3 -function getBrainfuckInput() { - const input = prompt("Enter a character (for Brainfuck input):"); - return input ? input.charCodeAt(0) : 0; // Returns the ASCII value of the character, or 0 if cancelled -} - class JSPlusPlus { static General = class { @@ -23,7 +18,10 @@ class JSPlusPlus { const output = []; // Input handling: A simple function to get one character from the user - + function getInput() { + const input = prompt("Enter a character (for Brainfuck input):"); + return input ? input.charCodeAt(0) : 0; // Returns the ASCII value of the character, or 0 if cancelled + } while (codePointer < code.length) { const command = code[codePointer]; @@ -45,7 +43,7 @@ class JSPlusPlus { output.push(String.fromCharCode(memory[pointer])); // Output the character at the current pointer break; case ',': - memory[pointer] = getBrainfuckInput(); // Read input from the user and store it in memory[pointer] + memory[pointer] = getInput(); // Read input from the user and store it in memory[pointer] break; case '[': if (memory[pointer] === 0) {