Подскажите почему не проходит проверка ?
solution.js
import {startMiningGame} from './gameEngine.js';
import {term,config} from './constants.js';
startMiningGame(term,config);
handlers.js
export const handleKeyPress = (term, state) => {
return (name, matches, data) => {
if (String.fromCharCode(data.code) == "g" ||
String.fromCharCode(data.code) == "G") {
return state.gold++
}
}
}
gameEngine.js
import { init } from "./functions.js"
import { handleKeyPress } from "./handlers.js"
export const startMiningGame = (term, state) => {
init(term)
const handler = handleKeyPress(term, state)
term.on('key', handler)
}
functions.js
export const init = (term) => {
term('Welcome to the mining game!')
term.clear()
term.hideCursor()
term.grabInput()
}
export const updateGold = (term, state) => {
term.moveTo(25, 2)
term.eraseLineAfter()
term.bold.yellow(`config.gold `)
}
constants.js
import terminalKit from 'terminal-kit';
export const term = terminalKit.terminal;
export const config = {
gold: 0,
}