- Make sure you have
ruby
installed, check https://www.tutorialspoint.com/ruby-on-rails/rails-installation.htm for more details - Download or clone the repository
- Extract the repository and change directory to the extracted folder
- Run the ruby script command! 👍
ruby run_game.rb [[6,2],[9,1],[1,8],[10],[4,1],[5,2],[0,3],[10],[7,0],[10,7,2]]
ruby run_game.rb [[10],[10],[10],[10],[10],[10],[10],[10],[10],[10,10,10]]
sample output:
[8, 18, 27, 42, 47, 54, 57, 74, 81, 100]
- Game can only have 10 frames
- A frame is invalid if (you can try the commands included):
- It is empty
ruby run_game.rb [[],[],[],[],[],[],[],[],[],[]]
- It has invalid number of inputs for Strike/Non-Strike frames
ruby run_game.rb [[6],[9,1],[1,8],[10],[4,1],[5,2],[0,3],[10],[7,0],[10,7,2]] ruby run_game.rb [[10,7,2],[9,1],[1,8],[10],[4,1],[5,2],[0,3],[10],[7,0],[10,7,2]] ruby run_game.rb [[6,2],[9,1],[1,8],[10],[4,1],[5,2],[0,3],[10],[7,0],[1,1,1]] ruby run_game.rb [[6,2],[9,1],[1,8],[10],[4,1],[5,2],[0,3],[10],[7,0],[10]]
- It has more than 2 values inside for frames 1-9
ruby run_game.rb [[1,1,1],[2,2,2],[3,3,3],[4,4,4],[4,1],[5,2],[0,3],[10],[7,0],[10,7,2]]
- It has more than 3 values inside for all frames
ruby run_game.rb [[1,1,1,1],[2,2,2,2],[3,3,3],[4,4,4],[4,1],[5,2],[0,3],[10],[7,0],[10,10,10,10]]
- It has values inside that are either negative, or more than 10
ruby run_game.rb [[-6,2],[9,11],[11,8],[10],[4,1],[5,2],[0,3],[10],[7,0],[10,7,2]]
- It has values inside that total to more than 10 for frames 1-9
ruby run_game.rb [[6,5],[9,1],[1,8],[10],[4,1],[5,2],[0,3],[10],[7,0],[10,10,10]]