Hi,
I’mm trying to do the High Scores exercise, but it does not make much sense to me. What is it that they’re actually asking me to do there? It is said that it’s a simple exercise in arrays as lists, but then when I look at the exercises, the functions have no explanation whatsoever. What does for example the scoresAfterBest property do?
the exercise JSON is as follows:
{
"exercise": "high-scores",
"comments": [
"This is meant to be an easy exercise to practise: ",
"* arrays as simple lists",
"* instantiating a class",
"Consider adding a track specific recommendation in the track's hint.md.",
"Consider linking to a explanatory blogpost or beginner level tutorials for both topics.",
"See Ruby Track hint.md for an example."
],
"cases": [
{
"uuid": "1035eb93-2208-4c22-bab8-fef06769a73c",
"description": "List of scores",
"property": "scores",
"input": {
"scores": [30, 50, 20, 70]
},
"expected": [30, 50, 20, 70]
},
{
"uuid": "6aa5dbf5-78fa-4375-b22c-ffaa989732d2",
"description": "Latest score",
"property": "latest",
"input": {
"scores": [100, 0, 90, 30]
},
"expected": 30
},
{
"uuid": "b661a2e1-aebf-4f50-9139-0fb817dd12c6",
"description": "Personal best",
"property": "personalBest",
"input": {
"scores": [40, 100, 70]
},
"expected": 100
},
{
"description": "Top 3 scores",
"cases": [
{
"uuid": "3d996a97-c81c-4642-9afc-80b80dc14015",
"description": "Personal top three from a list of scores",
"property": "personalTopThree",
"input": {
"scores": [10, 30, 90, 30, 100, 20, 10, 0, 30, 40, 40, 70, 70]
},
"expected": [100, 90, 70]
},
{
"uuid": "1084ecb5-3eb4-46fe-a816-e40331a4e83a",
"description": "Personal top highest to lowest",
"property": "personalTopThree",
"input": {
"scores": [20, 10, 30]
},
"expected": [30, 20, 10]
},
{
"uuid": "e6465b6b-5a11-4936-bfe3-35241c4f4f16",
"description": "Personal top when there is a tie",
"property": "personalTopThree",
"input": {
"scores": [40, 20, 40, 30]
},
"expected": [40, 40, 30]
},
{
"uuid": "f73b02af-c8fd-41c9-91b9-c86eaa86bce2",
"description": "Personal top when there are less than 3",
"property": "personalTopThree",
"input": {
"scores": [30, 70]
},
"expected": [70, 30]
},
{
"uuid": "16608eae-f60f-4a88-800e-aabce5df2865",
"description": "Personal top when there is only one",
"property": "personalTopThree",
"input": {
"scores": [40]
},
"expected": [40]
},
{
"uuid": "2df075f9-fec9-4756-8f40-98c52a11504f",
"description": "Latest score after personal top scores",
"scenarios": ["immutable"],
"property": "latestAfterTopThree",
"input": {
"scores": [70, 50, 20, 30]
},
"expected": 30
},
{
"uuid": "809c4058-7eb1-4206-b01e-79238b9b71bc",
"description": "Scores after personal top scores",
"scenarios": ["immutable"],
"property": "scoresAfterTopThree",
"input": {
"scores": [30, 50, 20, 70]
},
"expected": [30, 50, 20, 70]
},
{
"uuid": "ddb0efc0-9a86-4f82-bc30-21ae0bdc6418",
"description": "Latest score after personal best",
"scenarios": ["immutable"],
"property": "latestAfterBest",
"input": {
"scores": [20, 70, 15, 25, 30]
},
"expected": 30
},
{
"uuid": "6a0fd2d1-4cc4-46b9-a5bb-2fb667ca2364",
"description": "Scores after personal best",
"scenarios": ["immutable"],
"property": "scoresAfterBest",
"input": {
"scores": [20, 70, 15, 25, 30]
},
"expected": [20, 70, 15, 25, 30]
}
]
}
]
}