40 lines
1.6 KiB
Markdown
40 lines
1.6 KiB
Markdown
|
# High Scores
|
||
|
|
||
|
Manage a game player's High Score list.
|
||
|
|
||
|
Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score, the three highest scores, and a report on the difference between the last and the highest scores.
|
||
|
|
||
|
In this exercise you're going to instantiate a class and add some instance methods. http://ruby-for-beginners.rubymonstas.org/writing_classes/initializers.html
|
||
|
|
||
|
A HighScore accepts an array with one or more numbers, each representing one 'game score'. The Array class can offer inspiration for working with arrays. https://ruby-doc.org/core-2.5.1/Array.html
|
||
|
|
||
|
* * * *
|
||
|
|
||
|
For installation and learning resources, refer to the
|
||
|
[Ruby resources page](http://exercism.io/languages/ruby/resources).
|
||
|
|
||
|
For running the tests provided, you will need the Minitest gem. Open a
|
||
|
terminal window and run the following command to install minitest:
|
||
|
|
||
|
gem install minitest
|
||
|
|
||
|
If you would like color output, you can `require 'minitest/pride'` in
|
||
|
the test file, or note the alternative instruction, below, for running
|
||
|
the test file.
|
||
|
|
||
|
Run the tests from the exercise directory using the following command:
|
||
|
|
||
|
ruby high_scores_test.rb
|
||
|
|
||
|
To include color from the command line:
|
||
|
|
||
|
ruby -r minitest/pride high_scores_test.rb
|
||
|
|
||
|
|
||
|
## Source
|
||
|
|
||
|
Tribute to the eighties' arcade game Frogger
|
||
|
|
||
|
## Submitting Incomplete Solutions
|
||
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|