Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

[HOMEWORK] Clarifications on HW6-required

iacopomasi (5250 points)
46 65 95
in HW6 by (5.3k points)
edited by
Update November 25, 2022, 3 pm.

Yesterday night we updated the zip of HW6-req as we think it is clearer this way even if is different than the original game.
In general, what you need to follow are the instructions, clarifications, and expected results of the test cases. Secret tests will intentionally not include cases that are not covered by what is written in the outline or here in the clarifications. The purpose of the secret tests is NOT to mislead you but simply to change input/output always according to the same rules.

- You can assume that you can always write the initial position of the snake.
- You assume that there is always at least one command provided as input
- The snake can go diagonally obvious but cannot "cross" diagonally. See the example in the text but there are other cases as well. See below for the definition of "crossing".
- For diagonal crossing, although there are several more or less complicated cases, HW covers the simplest case where the snake dies if when it moves diagonally the other "adjacent" pixels diagonally are already occupied by the snake. Only one case is described in the HW text, but there are others to take into account depending on how the snake moves, always just checking if the "adjacent" pixels diagonally are already occupied by the reptile.
- When you start the snake is obviously one pixel long (otherwise we would have passed you an initial length)
- We have changed the behavior of the snake in case of death and handled by only one case.
    - If you hit an obstacle, the snake obviously does not cover the obstacle and the head stays in the previous square.
    - in contrast to the classic snake game, in which the snake can "chase" itself by retracting its tail and at the same time writing its head into the tail that now is writable, this case scenario is NOT covered and the snake dies in the case of "catching" the tail. We should have made these two diverse to render it more like the snake game but this way we make it easier and avoid confusion; we hope we do not penalize those who already solved it.
- You can of course use classes for those who already know how to use them (we'll see them in the next lessons)
- You can use static attributes of classes (we will see them in the next lessons)

I hope it clarifies and helps you.

1 Answer

e
enricomaria.follega (1460 points)
9 18 29
by (1.5k points)
There is one more point to be clarified.

If the snake dies, does it remains in the image or disappears?

i'm referring to "expected_end_01.png" & "expected_end_02.png".

In both tests the snake dies because of a wall, but in the first case it disappears, in the latter it remains.
e
enricomaria.follega (1460 points)
9 18 29
by (1.5k points)
nop, my bad.

just ran again my code and apparently for some reason the "expected_end_01.png" specific test the snake disappears . . .

OK my code works.
Lingfeng (480 points)
1 2 6
by (480 points)
It will not disappear, when the snake hit a red pixel, it will die and his head(last green pixel) will disappear without covering red, means that if you have an overlap between red and snake, the red pixel will win. In "expected_end_02.png" there is no green point because the snake had length 1.