A fan of the classic Creatures & Catacombs game, your friend has asked you to build some functions that will help calculate and search through dice rolls. Help them speed up their game by applying the accumulator pattern in your algorithms.
-
Fork and clone this repository.
-
Navigate to the cloned repository's directory on your command line. Then, run the following command:
npm install
This will install the libraries needed to run the tests.
-
Open up the repository in VSCode. Follow the instructions below to complete the Lab.
You will complete four functions in the index.js
file which will require you to apply the accumulator pattern to an array of numbers. Each time rolls
is mentioned, it refers to an array of numbers.
const rolls = [2, 4, 5, 2];
All of the numbers will be greater than 0.
Use the comments and tests to determine what each function needs to do.
To run the tests, you can run the following command from the command line. You will need to be in the root directory of your repository.
npm test
This will run the test output once.
If you'd like, you can have the tests run constantly. This means that each time you save your file, your tests will re-run. To do so, you can run the following:
npm run watch
Follow the on-screen prompts to exit out of the constant runner.