Skip to content

Commit

Permalink
Update task.md (#219)
Browse files Browse the repository at this point in the history
language checked
  • Loading branch information
stephen-hero authored Dec 20, 2023
1 parent b84ff2d commit 6906475
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions LastPush/CanvasGapsGenerator/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This step is not easy, but we believe you will solve it!

### Task

On this step you need to implement the `canvasWithGapsGenerator` function, which accepts the `pattern`, `width`, and `height` that were inputted by the user.
On this step, you need to implement the `canvasWithGapsGenerator` function, which accepts the `pattern`, `width`, and `height` that were inputted by the user.
This function should return a new string with a generated canvas-with-gaps picture.

<div class="hint" title="Click me to see the new signature of the canvasWithGapsGenerator function">
Expand All @@ -14,13 +14,13 @@ fun canvasWithGapsGenerator(pattern: String, width: Int, height: Int): String
</div>

The `canvasGaps` generator should build a rectangle `width` x `height` from the pattern,
while leaving gaps instead of every other element.
while leaving gaps in place of every other element.
The generator works according to the following algorithm:
1) **None of the levels** of the generated image **change** the pattern;
2) The gap is a rectangle of spaces, the dimensions
of which are equal to the width and height of the initial pattern;
3) In every **odd level**, the gap should be in **even** positions,
and in every **even level** - in **odd**;
and in every **even level** - in **odd** positions;
4) When repeated **vertically**, the pattern remains **unchanged**.

<div class="hint" title="Click me to see the `canvasGaps` filter examples">
Expand Down Expand Up @@ -58,7 +58,7 @@ None of the levels of the generated image change the pattern.
The following functions will _not be checked_, but they can help you implement this project:


- `repeatHorizontallyWithGaps`, which accepts a `pattern` and the number of times it should be repeated horizontally (n), e.g.:
- `repeatHorizontallyWithGaps`, which accepts a `pattern` and the number of times that pattern should be repeated horizontally (n), e.g.:
```text
n = 5
○○ ○○ ○○ ○○
Expand Down Expand Up @@ -86,6 +86,6 @@ If you need to drop <code>n</code> symbols from the beginning of a <code>String<
In industrial programming, duplicate code is commonly avoided and put into functions.
However, it is not always possible to immediately write clear and readable code.
Try implementing the <code>canvasGenerator</code> and <code>canvasWithGapsGenerator</code> functions
so that they pass all the tests and then start improving the code.
so that they pass all the tests and then proceed with improving the code.
This process is called <i>refactoring</i>.
</div>

0 comments on commit 6906475

Please sign in to comment.