Skip to content

Commit

Permalink
Merge pull request #171 from Daoortor/add-info
Browse files Browse the repository at this point in the history
Add information to the tasks about the location of words list
  • Loading branch information
Daoortor authored Jul 30, 2024
2 parents 6853783 + 271f79b commit 63a27b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion codenamesServer/codenamesServerCardService/task.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Wow! You've almost finished the project! This is the last step.

The package `jetbrains.kotlin.course.codenames.card` already has the regular class `CardService`. In this task, you need to implement the `generateWordsCards` function with the following behavior:
- If `words.size < TOTAL_NUMBER`, you need to throw an error. `words` is an already defined variable with `List<String>`, which contains all possible words for the game. You've already declared `TOTAL_NUMBER` in the `Utils` object in the `jetbrains.kotlin.course.codenames.utils` package.
- If `words.size < TOTAL_NUMBER`, you need to throw an error. `words` is a variable of type `List<String>` and is already defined in the `Words.kt` file of the `jetbrains.kotlin.course.codenames.utils` package. It contains all possible words for the game. You've already declared `TOTAL_NUMBER` in the `Utils` object in the `jetbrains.kotlin.course.codenames.utils` package.
- Next, you need to _shuffle_ `words` and create `TOTAL_NUMBER` cards by _taking_ them from the shuffled word list and creating new instances of the `Card` class (use `CardState.Front` as a state).
- Don't forget to _drop_ all words from the `words` list that were used for the generated cards.

Expand Down
8 changes: 4 additions & 4 deletions wordsGeneratorServer/wordsGeneratorServerWord/task.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
The **goal** of this step is to implement the `Word` and `WordServices` classes.
The **goal** of this step is to implement the `Word` and `WordService` classes.

First of all, create a value class `Word` with one `String` property `word` to store a word in the `jetbrains.kotlin.course.words.generator.word` package in the `WordModel.kt` file.

Next, find the already added `WordServices` class in the `jetbrains.kotlin.course.words.generator.word` package and modify it:
- Add a companion object to the `WordServices` class and declare the `numberOfWords` variable to store the number
of words in the game. Initialize this variable as the _size_ of the predefined list of words `words`.
Next, find the already added `WordService` class in the `jetbrains.kotlin.course.words.generator.word` package and modify it:
- Add a companion object to the `WordService` class and declare the `numberOfWords` variable to store the number
of words in the game. Initialize this variable as the _size_ of the predefined list of words `words` (which is defined in the `Words.kt` file of the `jetbrains.kotlin.course.words.generator.util` package).
- Implement the `generateNextWord` function: if the `words` list _is empty_, throw an error;
else, get the first element from the `words` list and remove it from the list, then create a new `Word` and return it.

Expand Down

0 comments on commit 63a27b6

Please sign in to comment.