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

Task #250, Stage #10 - Gold Mine

After implementing a producer purchase we need to make sure they do the work! Each second the producer should give us the amount of gold equal to their baseProduction. Add a new field productionRate to the config object exported from constants....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #11 - Gold Mine

The core of our mining game is implemented now. However, there are a few cosmetic things that we need to work on to provide a pleasant user experience. For starters, we’ll improve our config by adding two flags isInitCompleted: false and isProducerListUpdated: true...

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #12 - Gold Mine

The prep is done, so let’s start from the beginning. Once the user has enough gold to purchase the first producer, it makes sense to change the welcome message. I suggest creating a function checkInitCompleted that should be called from handleKeyPress once the user has enough gold to purchase the first producer....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #13 - Gold Mine

Next, we’re going to improve the UX by displaying the current list of producers. We’ll implement the function updateProducerList(term, state) in functions.js It should print the list of producers, each on the new line starting from line 5....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #14 - Gold Mine

Wow! The previous stages must have been hard. We still have some work to do, though. It’d be very useful for the user to see the current production rate of their mining empire....

August 15, 2020 · 1 min · Coderslang Master

Task #250, Stage #15 - Gold Mine

You might have noticed, that there are occasional issues with displaying the numbers in our game. Sometimes, there appear long weird tails after the decimal point. The other times the numbers get so big that it’s hard to make sense of them....

August 15, 2020 · 1 min · Coderslang Master

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