Rastler/project-lvl1-s168

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

Summary

Maintainability
A
0 mins
Test Coverage
import { core, getRandomInt } from '..';

const minRand = 1;
const maxRand = 25;
const rules = 'Answer "yes" if number even otherwise answer "no".';

const even = n => !(n % 2);

const gameGenerator = () => {
  const num = getRandomInt(minRand, maxRand);
  const correct = even(num) ? 'yes' : 'no';
  const question = `${num}`;
  return { correct, question };
};

export default () => {
  core(gameGenerator, rules);
};