# Problem with Number Guesser

I was trying to do Number guesser and I am totally lost. I did it in Codecademy, have not downloaded anything. My code was a bit too detailed and too long, but I completed every step as I could and it worked with no errors and showed up every result in a console, not in a game window.

So I decided to see Codecademy’s code for this practice to find, why my game window was not working, why it didn’t want to register input and now I am even more lost in everything.

It came in an archive with game.js and script.js. In the script.js was really simple code, which could be written in 10 mins, while I was trying to do mine for 1.5 hours.

It had variables I had no idea from where they came from, where they got their values (later I found, that they get their values from game.js)
Here is the part of the code with variables, that I thought are from nowhere:

const compareGuesses = (humanGuess, computerGuess, targetGuess) => {
const humanDifference = Math.abs(targetGuess - humanGuess)
const computerDifference = Math.abs(targetGuess - computerGuess)
return humanDifference <= computerDifference;
}

And now the question - how could I know what exactly variables to use if I was doing this practice in Codecademy? Not in notepad++ with having game.js in second window. I did not even know that this game.js existed. All I could do is to make code work in console, I had no idea that I needed to use exact variabes, that are in game.js, to make game screen work and react to buttons and register input, I thought, that the complete game must be made in one code, not in two parts. Can someone sort this thing out for me? From where I could know, what exactly to do? I never felt so lost before.

1 Like

Hi,

To me, the most important thing to take away from this is the troubleshooting mindset. It’s completely normal to come to a point where one is lost for entire days in new environments while you quickly try to digest all the documentation, stackoverflow, and colleagues’ advice your mind can handle. Often, the answer might be simple, but the overlying issue is adapting to the new environment and its rules. The key is not to panic, and to realize that some answers (even simple ones), just take time to emerge – even with the best problem-solving methodology. These experiences are vital for the skill-set of programmers in my opinion.

I think your example just serves to highlight that all the instructions in CC imply that you are using their system. If you want to write it in your own text editor (I always do), it’s only possible by making sure you can cycle through the attached files they use and copy those as well. I think that early on in modules, CC has different file tabs so for the more advanced modules they already assume you’re going to check how many files are interacting. They don’t pop out visually, I sure forgot about them a couple of times early on.

In a way you learned more because you tried to write a more complete program without any aid. It’s also good that you were completely confused as to why the functions came out of nowhere, because it’s important in general to avoid applying code you don’t understand conceptually (unless you’re just testing things out).

It’s tough, we’ve all been there… (and continue to be there…).

1 Like

Thanks for a such good words! Indeed, it was a massive experience. Next time I’ll definitely look into the files, Codecademy is providing. It was kinda foolish to hope, that every tiny bit of information needed will be in a right here in a decription of a task