You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/concept/train-driver/.docs/instructions.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,18 @@
1
1
# Instructions
2
2
3
-
Your friend is a Locomotive Engineer who drives cargo trains between cities.
4
-
Although your friend is great handling the trains, they aren't amazing handling the logistics computers and would like your programming help organizing the train and correcting mistakes in the data.
3
+
Your friend Linus is a train driver who drives cargo trains between cities. Although they are amazing at handling trains, they are not amazing at handling logistics or computers. They would like to enlist your programming help organizing train details and correcting mistakes in route data.
5
4
6
5
```exercism/note
7
6
To practice, use the rest or spread operator to solve each of the tasks below.
8
7
```
9
8
10
9
## 1. Create a list of all wagons
11
10
12
-
Your friend has been keeping track of each wagon identifier, but they're never sure how many wagons they are going to have to process at any given time. It would be much easier for the rest of the logistics program to have the data to be returned as an array.
11
+
Your friend has been keeping track of each wagon identifier (ID), but they are never sure how many wagons the system is going to have to process at any given time. It would be much easier for the rest of the logistics program to have this data packaged into a unified `array`.
13
12
14
-
Implement a function `getListOfWagons` that accepts an unknown amount of positive integers which are the IDs of each wagon.
13
+
Implement a function `getListOfWagons` that accepts an arbitrary number of wagon IDs which are the IDs of each wagon.
14
+
Each ID will be a positive integer.
15
+
The function should then return the given IDs as a single `array`.
## 2. Move the first two elements to the end of the array
22
23
23
-
At this point, you are starting to get a feel for your friend's data and how it's used in the logistics program.
24
-
The train ID system works by assigning the locomotive an ID of `1` and then assigning the remainder of the wagons a randomly chosen ID greater than `1`.
24
+
At this point, you are starting to get a feel for the data and how it's used in the logistics program. The ID system always assigns the locomotive an ID of **1**, with the remainder of the wagons in the train assigned a randomly chosen ID greater than **1**.
25
25
26
-
But then your friend had to connect two new wagons to the train and forgot to update the system!
27
-
Now the first two wagons in the `array` have to be moved to the back of the train, or everything will be out of order.
28
-
Your friend would be really grateful to you for fixing their mistake.
26
+
Your friend had to connect two new wagons to the train and forgot to update the system! Now, the first two wagons in the train `array` have to be moved to the end, or everything will be out of order.
27
+
28
+
Linus would be really grateful to you for fixing their mistakes.
29
29
30
30
Implement a function `fixListOfWagons` that accepts an array of the id of each wagon.
31
-
It `return` an `array` where the 2 first elements repositioned to the end of the `array`and the locomotive is added to the front.
31
+
It `return` an `array` where the 2 first elements repositioned to the end of the `array`so that the locomotive can be in the front.
0 commit comments