diff --git a/README.md b/README.md index 7c4e455..84b6323 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,4 @@ [![Actions Status](https://github.com/Tanya14081981/frontend-project-44/workflows/hexlet-check/badge.svg)](https://github.com/Tanya14081981/frontend-project-44/actions)[![Maintainability](https://api.codeclimate.com/v1/badges/fb74f85f99b4a3def279/maintainability)](https://codeclimate.com/github/Tanya14081981/frontend-project-44/maintainability) [![asciicast](https://asciinema.org/a/zvjF8kuKtS1kQq1tsTn6nrJ9X.svg)](https://asciinema.org/a/zvjF8kuKtS1kQq1tsTn6nrJ9X) [![asciicast](https://asciinema.org/a/80aEm0j9jSN4PvcgJ6dGstUcG.svg)](https://asciinema.org/a/80aEm0j9jSN4PvcgJ6dGstUcG) +[![asciicast](https://asciinema.org/a/AslmjHGvRdJ3wVy362nPGGLUV.svg)](https://asciinema.org/a/AslmjHGvRdJ3wVy362nPGGLUV) diff --git a/bin/brain-gcd.js b/bin/brain-gcd.js old mode 100644 new mode 100755 index 602e09f..d67f11e --- a/bin/brain-gcd.js +++ b/bin/brain-gcd.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -import maxGeneralDivider from '../games/calc.js'; +import maxGeneralDivider from '../games/gcd.js'; maxGeneralDivider(); diff --git a/games/gcd.js b/games/gcd.js index 4299831..bef4a6d 100644 --- a/games/gcd.js +++ b/games/gcd.js @@ -5,10 +5,11 @@ import greetGamer from '../src/cli.js'; import getRandomInt from '../function/getRandomInt.js'; const getMaxDevidor = (numberOne, numberTwo) => { - let maxDevidor = 0; + const maxNum = Math.max(numberOne, numberTwo); + let maxDevidor = 1; let value1 = numberOne; let value2 = numberTwo; - for (let i = 1; i <= numberOne; i += 1) { + for (let i = 1; i <= maxNum; i += 1) { if (value1 === value2) { maxDevidor = value1; } else if (value1 > value2) {