Skip to content

Commit 0af03bb

Browse files
authored
Merge pull request #99 from jetbrains-academy/stephen-hero-patch-2
Update task.md
2 parents 83c1ac3 + 9909492 commit 0af03bb

File tree

1 file changed

+32
-32
lines changed
  • aliasServer/aliasServerFinishGame

1 file changed

+32
-32
lines changed
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
Congratulations! Your game is almost ready, it remains only to add the display of the leaderboard at the end of the game
2-
and the for the previous rounds.
3-
In this task implement several things in the already defined class `GameResultsService` in
1+
Congratulations! Your game is almost ready it remains only to add the display of the leaderboard at the end of the game
2+
and store the results for the previous rounds.
3+
In this task, you will implement several things in the already defined class `GameResultsService` in
44
the `jetbrains.kotlin.course.alias.results` package:
55

66
- add a type alias `GameResult` to `List<Team>`;
77
- add a companion object into the `GameResultsService`
88
and declare the `gameHistory` variable to store the list of game results (`MutableList<GameResult>`).
99
By default, it must be initialized via an empty list.
1010
- implement the `saveGameResults` method that adds the `result` into the `gameHistory`.
11-
Before adding the `result` you need to check two requirements and throw an error if they are broken: 1) `result` must
12-
be not empty; 2) all teams ids from the `result` must be in the `TeamService.teamsStorage`.
11+
Before adding the `result`, you need to check two requirements and throw an error if they are broken: 1) `result` must
12+
be not empty; 2) all team ids from the `result` must be present in the `TeamService.teamsStorage`.
1313
- implement the `getAllGameResults` method that returns the reversed `gameHistory` list.
1414

1515
<div class="hint" title="I press Check and see a compilation error">
16-
If you have a compilation error, and you have not solved this step yet, please solve the task and try again.
17-
It is expected behavior since the code requires the type alias `GameResult`, but it does not exist.
16+
If you have a compilation error and you have not solved this step yet, please solve the task and try again.
17+
It is expected behavior, since the code requires the type alias `GameResult`, but it does not exist.
1818
</div>
1919

20-
Hooray! After finishing this step the game will work well:
20+
Hooray! After finishing this step, the game will work well:
2121

2222
![The current state of the game](../../utils/src/main/resources/images/states/alias/state2.gif)
2323

2424
<div class="hint" title="Possible ways to extend the project">
2525

2626
Congratulations! You did a great job and created a working application.
27-
We have put together a few ideas on how you can improve this project by yourself.
28-
These improvements will not be tested by tests within the course.
27+
We have put together a few ideas on how you can further improve this project by yourself.
28+
These improvements will not be tested within the course.
2929
Some improvements require changes to both the client (what is displayed in the browser)
30-
and the server (application logic).
31-
We don't cover client-server architecture in this course,
32-
so you can either explore them on your own or explore ideas that don't require investigating third-party code.
30+
and the server (the application logic).
31+
We don't cover the client-server architecture in this course,
32+
so you can either explore that on your own or implement ideas that don't require investigating third-party code.
3333

3434
**Server improvements:**
3535

36-
- Currently, the application throws an error if something went wrong,
36+
- Currently, the application throws an error if something goes wrong:
3737
for example, the application throws an error if the list with words for new cards becomes empty.
3838
As an improvement, you can add handling of this kind of error.
3939
- You can add categories for the words on the card, such as animals,
4040
countries, or movies to make the game process more diverse.
41-
At the beginning of the game you can generate a random category as the default option.
42-
- Currently, we lost the game progress if we turn off the server.
43-
You can implement the ability to save the current state of the game in files
44-
and when the server is starting you can extract this data.
41+
At the beginning of the game, you can generate a random category as the default option.
42+
- Currently, we lose the game progress if we turn off the server.
43+
You can implement the ability to save the current state of the game in files,
44+
and when the server is starting, you can extract this data.
4545

4646
**Client improvements:**
4747

48-
- Error handling can be added not only on the server, but also on the client,
48+
- Error handling can be added not only on the server but also on the client side:
4949
for example, you may show a dialog window with the error message.
50-
- Words categories can be added not only on the server, but also on the client,
50+
- Word categories can be added not only on the server, but also on the client side:
5151
for example, you may add a new screen to choose the category.
52-
- You can add a list of forbidden words that cannot be used while describing the word on the card.
53-
On the client side for this improvement you need to show this list of words.
52+
- You can add a list of forbidden words, which cannot be used while describing the word on the card.
53+
On the client side, for this improvement you need to show such a list of words.
5454
</div>
5555

5656

@@ -62,15 +62,15 @@ If you have any difficulties, **hints will help you solve this task**.
6262

6363
<div class="hint" title="The `isNotEmpty` built-in function">
6464

65-
If you need to check if a list is not empty you can check its size ot use the [isNotEmpty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/is-not-empty.html) built-in function:
65+
If you need to check that a list is not empty, you can check its size or use the built-in [isNotEmpty](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/is-not-empty.html) function:
6666

6767
```kotlin
6868
val numbers = listOf(1, 2, 3)
6969
if (numbers.size != 0) {
7070
TODO()
7171
}
7272
```
73-
is the **same** with
73+
It is the **same** as
7474

7575
```kotlin
7676
val numbers = listOf(1, 2, 3)
@@ -82,14 +82,14 @@ is the **same** with
8282

8383
<div class="hint" title="`contains` and `in`">
8484

85-
In Kotlin you can use [operators](https://kotlinlang.org/docs/java-interop.html#operators) insted several functions to make code shorter.
85+
In Kotlin, you can use [operators](https://kotlinlang.org/docs/java-interop.html#operators) insted of several functions to make code shorter.
8686
For example, instead of the `contains` function, you can use the `in` operator to check if the collection contains some element:
8787

8888
```kotlin
8989
val numbers = listOf(1, 2, 3, 4)
9090
println(numbers.contains(1)) // true
9191
```
92-
is the **same** with
92+
It is the **same** as
9393
```kotlin
9494
val numbers = listOf(1, 2, 3, 4)
9595
println(1 in numbers) // true
@@ -99,21 +99,21 @@ is the **same** with
9999

100100
<div class="hint" title="The `all` built-in function">
101101

102-
If you need to check that **all** elements match the given predicate, you can use the [`all`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/all.html) built-in function.
103-
The predicate you need to put into the curly brackets:
102+
If you need to check that **all** elements match the given predicate, you can use the built-in [`all`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/all.html) function.
103+
You need to put the predicate in curly brackets:
104104

105105
```kotlin
106106
val evenNumbers = listOf(2, 4, 6)
107107
println(evenNumbers.all { it % 2 == 0 }) // true
108-
println(evenNumbers.all { it == 4 }) // false, because only one item satisfies the predicate
108+
println(evenNumbers.all { it == 4 }) // false because only one item satisfies the predicate
109109
```
110110
</div>
111111

112112
<div class="hint" title="The `reversed` built-in function">
113113

114114
If you need to get a list in which the elements are in reverse order,
115115
you can loop through the elements of the original list from the end to the beginning and
116-
return a new list, or use the [`reversed`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/reversed.html) built-in function:
116+
return a new list or use the built-in [`reversed`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/reversed.html) function:
117117

118118
```kotlin
119119
val numbers = listOf(1, 2, 3, 4)
@@ -124,10 +124,10 @@ return a new list, or use the [`reversed`](https://kotlinlang.org/api/latest/jvm
124124
println(reversedList) // [4, 3, 2, 1]
125125
```
126126

127-
is the **same** with
127+
It is the **same** as
128128
```kotlin
129129
val numbers = listOf(1, 2, 3, 4)
130130
val reversedList = numbers.reversed()
131131
println(reversedList) // [4, 3, 2, 1]
132132
```
133-
</div>
133+
</div>

0 commit comments

Comments
 (0)