Skip to content

Commit 92ecfba

Browse files
committed
fixes
1 parent 77ca83d commit 92ecfba

File tree

1 file changed

+27
-43
lines changed

1 file changed

+27
-43
lines changed

exercises/concept/train-driver/.docs/instructions.md

Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,76 @@
22

33
Your friend is a train driver and has to drive cargo trains between cities.
44
Although your friend isn't amazing with handling the computers and would like some help with it.
5-
Your friend would like your help organizing the train and correcting the mistakes in the data.
5+
Your friend would like your help organizing the train and correcting mistakes in the data.
66

77

88
```exercism/note
9-
To practice, use a for the rest or spread to solve each of the tasks below.
9+
To practice, use the rest or spread operator to solve each of the tasks below.
1010
```
1111

12-
## 1. Convert the data to an array
12+
## 1. Create a list of all wagons
1313

14-
Your friend has been keeping track of how much each wagon weighs. Although they are not sure how many wagons and would like the data to be returned as an array.
14+
Your friend has been keeping track of eachs wagon identifer. Although they are not sure how many wagons and would like the data to be returned as an array.
1515

16-
```exercism/note
17-
18-
Implement a function `getListOfWagons` that accepts an unknown amount of whole numbers that contains the weight of each wagon.
19-
It should return an array of all the wagon weights.
20-
21-
```
16+
Implement a function `getListOfWagons` that accepts an unknown amount of possitve whole numbers that contains the id of each wagon.
17+
It should return an array of all the wagon ids.
2218

2319
```javascript
24-
getListOfWagons(5, 7, 12, 3, 14, 8, 3);
25-
// => [5, 7, 12, 3, 14, 8, 3]
20+
getListOfWagons(1, 7, 12, 3, 14, 8, 5);
21+
// => [1, 7, 12, 3, 14, 8, 3]
2622
```
2723

2824
## 2. Move the first two elements to the end of the array
2925

30-
Now that you got a general feel for handling your friend's data. Your friend has noticed that the first two days' values are not in the correct place.
31-
Your friend would like you to move the first two days' value to the end of the array.
32-
33-
```exercism/note
26+
Now that you got a general feel for handling your friend's data.
27+
The train id system works by the locomotive having id one and the rest of the wagons geting a random id.
28+
You friend had to connect two new wagons to the train and forgot to update the id system.
29+
Now the first two wagons in the array has to be moved to the back of the train.
30+
Your friend would like you to move the first two wagons to the end of the array.
3431

35-
Implement a function `fixListOfWagons` that accepts an array of the weight of each wagon.
32+
Implement a function `fixListOfWagons` that accepts an array of the id of each wagon.
3633
It returns an array where the 2 first elements are moved to the end of the array.
3734

38-
```
39-
4035
```javascript
41-
eachWagonsWieght = [2, 5, 0, 7, 4, 0, 1, 3, 1];
36+
eachWagonsWieght = [2, 5, 1, 7, 4, 12, 6, 3, 13];
4237
fixListOfWagons(eachWagonsWieght);
43-
// => [0, 7, 4, 0, 1, 3, 1, 2, 5]
38+
// => [1, 7, 4, 12, 6, 3, 13, 2, 5]
4439
```
4540

4641
## 3. Add missing values
4742

48-
Your friend realized that all data wasn't added and found another array which contains the missing values.
43+
Your friend realized that all data wasn't added and found another array which contains the missing wagons.
4944
Your friend would like you to add the missing values to the array.
50-
All they can remember is that the missing values should be placed after the first element in the array.
51-
52-
53-
```exercism/note
45+
All they can remember is that the missing values should be placed after the locomotive in the array.
5446

55-
Given this new information, write a function called `CorrectListOfWagons` that takes two arrays which have the values of the weight of each wagon as an argument.
47+
Given this new information, write a function called `CorrectListOfWagons` that takes two arrays which have the id of of each wagon as an argument.
5648
The second array should be added after the first element of the first array.
5749

58-
```
59-
60-
6150
```javascript
62-
eachWagonsWieght = [2, 5, 0, 7, 4, 1];
63-
missingWagons = [3, 0, 6, 1];
51+
eachWagonsWieght = [1, 5, 20, 7, 4, 8];
52+
missingWagons = [3, 17, 6, 15];
6453
CorrectListOfWagons(eachWagonsWieght, missingWagons);
65-
// => [2, 3, 0, 6, 1, 5, 0, 7, 4, 1]
54+
// => [1, 3, 17, 6, 15, 5, 20, 7, 4, 8]
6655
```
6756

68-
## 4. Update routing information
57+
## 4. Extend routing information
6958

7059
Now that the wagon data is correct, your friend would like you to update the routing information.
7160
Your friend has an object with the routing information and would like you to add more routing information to the object.
7261
Every route requires a bit different information so your friend would prefer a generic solution.
7362

74-
75-
```exercism/note
76-
77-
Implement a function `updateRoutingInformation` that accepts two objects.
63+
Implement a function `extendRouteInformation` that accepts two objects.
7864
The first object contains which city the train should go between and the second object contains more routing information.
7965
The function should return an object with the updated routing information.
8066

67+
```exercism/note
68+
The variable `moreRouteInformation` can contain diffrent properties.
8169
```
8270

8371
```javascript
8472
route = {from: "Berlin", to: "Hamburg"};
8573
moreRouteInformation = {length: 100, speed: 50};
86-
updateRoutingInformation(route, moreRouteInformation);
74+
extendRouteInformation(route, moreRouteInformation);
8775
// => {from: "Berlin", to: "Hamburg", length: 100, speed: 50}
8876
```
8977

@@ -92,13 +80,9 @@ updateRoutingInformation(route, moreRouteInformation);
9280
Your friend has noticed that they don't need the arrival time in the routing information.
9381
Therefore your friend would like you to remove the arrival time from the routing information.
9482

95-
```exercism/note
96-
9783
Implement a function `removeArrivalTime` that accepts an object with the routing information.
9884
The function should return an object
9985

100-
```
101-
10286
```javascript
10387
routeInformation= {
10488
from: "Berlin",

0 commit comments

Comments
 (0)