diff --git a/AlmostDone/StringFunctionsPartTwo/task.md b/AlmostDone/StringFunctionsPartTwo/task.md index d7696ac8..f6f80b54 100644 --- a/AlmostDone/StringFunctionsPartTwo/task.md +++ b/AlmostDone/StringFunctionsPartTwo/task.md @@ -3,12 +3,12 @@ Let's implement the second filter! ### Task Implement the `applySquaredFilter` function. -For the border symbol, please use the pre-defined variable `borderSymbol`, it stores `#`: +For the border symbol, please use the predefined variable `borderSymbol`, which stores `#`: ```kotlin println(borderSymbol) // # ``` -
+
Here's an example of the function's work:

@@ -17,23 +17,23 @@ Here's an example of the function's work:

To make the picture prettier, add a separator between the picture and the border. -For the separator, please use the pre-defined variable `separator` that stores a space. +For the separator, please use the predefined variable `separator`, which stores a space. ```kotlin -println("It is the value from the separator variable: $separator.") // It is the value from the separator variable: . +println("This is the value from the separator variable: $separator.") // This is the value from the separator variable: . ``` -**Note that the picture might not be a square, which means the width of different lines in the picture can be different.** -In other words, you need to pad the shorter lines with the `separator` to the length to make the image square. -To get the width of the picture, you cak use the predefined function `getPictureWidth`, -that returns the maximum of width from all lines from the picture. +**Note that the picture might not be a square, which means the width of different lines in the picture can vary.** +In other words, you need to pad the shorter lines with the `separator` to make the image square. +To get the width of the picture, you can use the predefined function `getPictureWidth`, +which returns the maximum length of all picture lines. -
+
```kotlin -val pictureWidth = getPictureWidth(picture) // calculate the longest line from the picture and returns it's width +val pictureWidth = getPictureWidth(picture) // calculate the longest line in the picture and returns its length ``` -In addition, the project already stores the `newLineSymbol` variable, which can be used to add new lines between new generated picture lines, e.g.: +In addition, the project already stores the `newLineSymbol` variable, which can be used to add new lines between newly generated picture lines, e.g.: ```kotlin val line1 = "#######" val line2 = "#######" @@ -55,7 +55,7 @@ If you have any difficulties, **hints will help you solve this task**. ### Hints -
+
First example: Example of the function's work @@ -64,15 +64,15 @@ Second example: Example of the function's work
-
+
-To check how your function works, you can run it in main by passing one of the pre-defined pictures: +To check how your function works, you can run it in main by passing one of the predefined pictures: ```kotlin fun main() { - applyFilter(simba, "squared") // an example with simba picture - applyFilter(monkey, "squared") // an example with monkey picture - applyFilter(android, "squared") // an example with android picture (this picture has different length of lines) + applyFilter(simba, "squared") // an example with the simba picture + applyFilter(monkey, "squared") // an example with the monkey picture + applyFilter(android, "squared") // an example with the android picture (this picture has different line lengths) } ```
@@ -80,16 +80,16 @@ fun main() {
-You can use the `applyBordersFilter` function to add the borders, next -create two `StringBuilder`s (one for the top and one for the bottom part), -and put them row by row. +You can use the `applyBordersFilter` function to add borders. Next, +create two `StringBuilder` instances — one for the top part and the other for the bottom. +Proceed to poopulate them row by row.
-
+
-If you want, you can try to implement your own implementation fo the `getPictureWidth` function: -split the picture by using `lines` function -and next use the `maxOfOrNull` function to calculate -the maximum length from picture lines. +If you want, you can try to implement your own version of the `getPictureWidth` function: +split the picture using the `lines` function +and then use the `maxOfOrNull` function to calculate +the maximum length of all picture lines.