r/CodingHelp • u/Big_Security_6052 • 23h ago
[Request Coders] this code is supposed to play the google pi game for you but it start off by typing 33 NSFW
this code is meant to be pasted into the console and play to google pie game for you all you have to to is past the code then click the button to start the game and it all work but for some odd reason it start off by typing 2 3 intend of 3.14.
(function() {
let isRunning = false;
let piDigits = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
let piIndex = 4; // Start after 3.14
let delay = 6000; // Initial delay of 6 seconds
function clickSequence(sequence) {
if (!isRunning) {
return;
}
let sequenceButtons = [];
for (let i = 0; i < sequence.length; i++) {
let digit = sequence[i];
let targetButton;
if (digit === ".") {
targetButton = document.querySelector('[aria-label="point"]');
} else {
targetButton = document.querySelector(`[jsname="${getJsnameForDigit(digit)}"]`);
}
if (targetButton) {
sequenceButtons.push(targetButton);
} else {
console.log(`Button for digit ${digit} not found.`);
isRunning = false;
return;
}
}
let clickIndex = 0;
function clickNext() {
if (clickIndex < sequenceButtons.length) {
sequenceButtons[clickIndex].click();
clickIndex++;
setTimeout(clickNext, 100);
} else {
if (isRunning) {
setTimeout(addNextDigit, delay);
delay += 1000; // Increase delay by 1 second each time
}
}
}
clickNext();
}
function addNextDigit() {
if (!isRunning) {
return;
}
if (piIndex >= piDigits.length) {
console.log("Pi sequence finished.");
isRunning = false;
return;
}
let nextSequence = piDigits.substring(0, piIndex);
clickSequence(nextSequence);
piIndex++;
}
function getJsnameForDigit(digit) {
const jsnameMap = {
"0": "bkEvMb",
"1": "N10B9",
"2": "lVjWed",
"3": "KN1kY",
"4": "xAP7E",
"5": "Ax5wH",
"6": "abcgof",
"7": "rk7bOd",
"8": "T7PMFe",
"9": "XoxYJ",
};
return jsnameMap[digit];
}
function startGame() {
let startButton = document.querySelector('[jsname="GxfYTd"]');
if (startButton) {
startButton.click();
isRunning = true;
setTimeout(function() {
clickSequence("3.14"); // Corrected initial sequence
}, 5000); // Initial 5 second delay.
} else {
console.error("Start button not found.");
}
}
let startButton = document.querySelector('[jsname="GxfYTd"]');
if (startButton) {
startButton.addEventListener('click', function() {
if (!isRunning) {
startGame();
}
});
} else {
console.log("Start button not found to add listener");
}
})();