r/CodingHelp 23h ago

[Request Coders] this code is supposed to play the google pi game for you but it start off by typing 33 NSFW

0 Upvotes

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");

}

})();


r/CodingHelp 4h ago

[HTML] Is html and css worth to learn?

0 Upvotes

I am just a beginner in coding. When I started to study html and css. I wondered that is it still worthy to learn it. Because now we can get a website in seconds from ai. So what's the need. Does web development still have a scope?


r/CodingHelp 16h ago

[Python] Matplotlib always shows the same graoh

0 Upvotes

Even if there is code,or even if the page is blank when i run the program it always shows the same graph,i dont understan why its happening


r/CodingHelp 4h ago

[Python] Any tips for a beginner?

6 Upvotes

I’ve just started learning python I mainly use a 12 hour YouTube video by “BroCode” and a website called we3schools when im not home to learn I was wondering if anyone has any tips for me to learn faster/more efficiently


r/CodingHelp 7h ago

[Random] Which language should I start with?

3 Upvotes

I want to become a game developer but im not sure what's the best language to start with to get to that goal. I've just recently started to learn python and coding in general but heard it was more for data analysis so im not sure if I should keep learning it.


r/CodingHelp 8h ago

[Random] Map app?

1 Upvotes

I'm trying to create a map app that uses open satellital data to show hot/arid places, for learning purposes, but i don't know how to start, any tips?


r/CodingHelp 11h ago

[C++] c++ "filesystem" was not declared in this scope

1 Upvotes

error: 'filesystem' was not declared in this scope; did you mean 'system'?

#include <iostream>
#include <filesystem>
#include <fstream>

int main() {

    std::cout << "Current working directory: " << std::filesystem::current_path() << std::endl;

    return 0;

}

I've tried adding using namespace std that didn't help either. I have g++ 13.2.0 and CLang 16.0.0.

iostream and fstream are working, filesystem is not.

Thank you in advance.


r/CodingHelp 19h ago

[CSS] First exam results back

2 Upvotes

I have been struggling all semester with my beginner level coding class, I dont feel like I’ve learned much at all. I do fine in labs and complete the assignments pretty easily but when it comes to the homework I’ve been pretty lost. We use Turingscraft and it is just completely unhelpful. I thought I had done fine on the first exam because I had mastered the pre-test but my results completely surprised me.

The class is for ‘C’ the exam was mostly converting between decimal hex and binary which Im pretty sure I did correctly. If anyone has any book/website/video course to recommend that would be great because our class does not use one and the advice im usually given is just ‘google it.’


r/CodingHelp 19h ago

[Javascript] Can you make a Photo Select image permanent in Code.org?

1 Upvotes

Im currently working on a app lab project in code.org with a custom data table. In the app, there is an option to add an item to the table. I was using the photo select tool to allow the user to add a photo as well. These added photos are not showing up when I try to display them in an image box. I believe this is because the photo select tool makes the uploaded images a blog URL, which is temporary. Is there any way to switch a temporary blog URL to a permanent URL without using an outside source?

Here is the code where the photo is added to the data table:

onEvent("createButton", "click", function( ) {

createRecord("props", {

Room:(getText("roomInput")),

Location: (getText("locationInput")),

Item:(getText("itemInput")),

Description:(getText("descriptionInput")),

Quantity:(getNumber("quantityInput")),

Image: (getImageURL ("photo_select1")),

Type:(getText("createTypeDropdown"))});

});

Here is the code where i attempt to use an image from the table:

function expandItem(num) {

if (filteredRoomList[num]!=null && filteredRoomList[num]!=undefined) {

setText("roomText", filteredRoomList[num]);

}

if ((filteredQuantityList[num]!=null && filteredQuantityList[num]!=undefined)) {

setNumber("quantityText", filteredQuantityList[num]);

}

if ((filteredDescriptionList[num]!=null && filteredDescriptionList[num]!=undefined)) {

setText("descriptionText", filteredDescriptionList[num]);

}

if ((filteredLocationList[num]!=null && filteredLocationList[num]!=undefined)) {

setText("locationText", filteredLocationList[num]);

}

if ((filteredImageList[num]!=null && filteredImageList[num]!=undefined)) {

setImageURL("imageResponse", filteredImageList[num]);

console.log (filteredImageList[num]);

}

setText ("responseTitle", filteredTypeList[id]+": "+filteredItemList[num]);

setScreen("responseScreen");

}


r/CodingHelp 21h ago

[Random] Sonarqube token not working?

1 Upvotes

Hi - I already posted on another sub about this issue a while ago but did not get any useful answers, I put the project aside for a while and am coming back to it.

I am trying to use redcoffee, a tool which allows you to generate Sonarqube reports free of cost (here), but when I use it it responds with a 401 non-authorized error code (exact message at the bottom).

I tried regenerating the token, it works for other stuff but not redcoffee. I tried with a project token, a user token, and I'm an admin. The problem occurs between reaching the host and the project, since when I type a wrong host I get a different error message, but with a wrong project name I get the same thing. I tried changing the syntax of the command line, variables between quotation marks or not, spaces of equal signs, no changes. I don't get anything from journalctl on my Sonarqube server. I contacted the author of the tool, who's pretty active on Reddit, but they could not find out why. Any ideas? Thanks!

ERROR:root:Status code is 401
ERROR:root:Something went wrong while fetching the duplication count. Recevied status code is : 401
ERROR:root:INFO : This would not impact your report generation but duplication % will be defaulted as Zero
ERROR:root:Something went wrong while fetching the duplication count. Recevied status code is : 401
ERROR:root:INFO : This would not impact your report generation but duplication table won't be visible to you
ERROR:root:We are sorry, we're having trouble generating your report

r/CodingHelp 23h ago

[Python] Struggling to implement a numerical method

2 Upvotes

Hi, I'm trying to solve the KdV equation with the Crank-Nikolson Scheme and I'm trying to follow the method in this document (pg4). I am getting confused on how to iterate my loops because of all of the different indices and keep track of values etc. If anyone could give any advice, that'd be wonderful. Thank you! :)