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
It should move to the coordinates (25, 2), erase everything that comes after it and then print the property
state.gold in yellow color and bold font followed by 3 spaces.
Once you’ve implemented
updateGold, you can call it from
handleKeyPress and update the gold value when
the user hits the ‘G’ key.
P.S. Use functions term.moveTo(x, y), term.bold.yellow(message) and term.eraseLineAfter()
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.