🚀 CYBER WEEK SALE: 50% OFF on JavaScript Fundamentals 💪

Task #250, Stage #16 - Gold Mine

At the moment, we’re updating the UI once a second. It’s ok, but it’d be a lot smoother if it was updating more often. Let’s say 10 times faster. You’ll need to change the code in quite a few places,...

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #2 - Gold Mine

Our game should interact with the user in 2 ways. It should know how to accept the keyboard input, and it should know how to print messages to the console....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #3 - Gold Mine

So, you’ve already exported the constant term that will allow us to control the terminal. Let’s make some use of it! Create the file functions.js and export the function init from it....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #4 - Gold Mine

Congratulations on passing the stage 3! You might be wondering why we have 4 files, a third party module and quite a few lines of code to output a single message on the screen… And the answer is that this structure will allow our code to be flexible,...

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #5 - Gold Mine

Now, let’s work on the function that will be called if the user clicks the key G on the keyboard. Implement and export the function handleKeyPress(term, state) in the handlers.js....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #6 - Gold Mine

The handler is ready, so we need to connect it with the keypress event. But before that we need to improve the init function. It accepts a single parameter and should call on it:...

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #7 - Gold Mine

So, now we can start mining gold in manual mode by pressing key ‘G’ key. Let’s print the result of our actions on the screen. Implement and export the function updateGold(term, state) from functions....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #8 - Gold Mine

Great! The manual mode is done, so we should think about automating our mining empire. Add a new field producers into the config constant that was exported from solution.js. It should be an array of objects....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #9 - Gold Mine

Now let’s add the ability for the user to purchase new producers. If you’ve created producers with single digit ids, you did everything right. If not, you can still fix it....

August 15, 2020 · 1 min · Coderslang Master

Task #2501 - Applying colors

The document has already added a title and five colored button elements. When you click on any of the buttons, the text color of the h2 heading should change to the one indicated on the button....

August 15, 2020 · 1 min · Coderslang Master