nbvehbq/project-lvl1-s89

View on GitHub
src/games/even-game.js

Summary

Maintainability
A
0 mins
Test Coverage
import random from '../lib/utils';
import playGame from '../lib/core';

const queryProcessor = () => {
  const question = random(0, 100);
  const correctAnswer = question % 2 ? 'no' : 'yes';
  return {
    question,
    correctAnswer,
  };
};

const gameData = {
  rule: 'Answer "yes" if number even otherwise answer "no".',
  queryProcessor,
};

export default () => playGame(gameData);