suchja / awesome-qt-snake

A portfolio and learning project show casing my OOP, OOAD, Qt6 and C++ skills.
The Unlicense
0 stars 0 forks source link

As a player, I want to control the snake in all four directions (up, down, left and right) so that I can play the game. #4

Closed suchja closed 3 weeks ago

suchja commented 1 month ago

Notes

Acceptance Criteria

Last Acceptance criteria replaced (initial version kept for traceability), because it contradicted with the "opposite direction" criteria

suchja commented 1 month ago

Adding it to milestone 0.1 as it is core gaming logic

suchja commented 3 weeks ago

What is required for the whole story?

suchja commented 3 weeks ago

Starting with the first test:

  • User presses "return" or "W" key,
    • Snake keeps moving into the previously set direction and
    • Hint "Key is not supported!" is shown in the statusbar
suchja commented 3 weeks ago

Proceeding with next test:

Snake currently moves up and user presses arrow down key:

  • Snake does not change direction (move is ignored)
  • A hint is shown to the user "Not possible to immediately go to opposite direction!"
  • hint disappears with next "correct" arrow key
suchja commented 3 weeks ago

Here we go with the next test:

Snake (head & 1 body element) currently moves to the left and user presses arrow up key.

  • at next move the head moves one tile up while the remaining body still moves one tile to the left
  • one additional move and the head moves still up, the element of the body now follows up.
suchja commented 3 weeks ago

Now let's move to the final test:

Important: Behavior / Test changed as it was inconsistent in its original version!

Snake moves down and user presses (between 2 moves)

  • arrow left key and arrow right key (immediately one after another)
    • This would result in the the opposite direction handling as covered by previous test, but
    • To have a consistent behavior only the first key press will be accepted. Once an arrow key is pressed, the snake needs to move first, before another arrow key press is accepted.
  • arrow left key and arrow up key (immediately one after another)
    • Only the first key press will be accepted. Once an arrow key is pressed, the snake needs to move first, before another arrow key press is accepted.
    • This case would otherwise imply an implicit move to the opposite direction!
  • If one of these cases is detected, the message "Only one direction change per move is allowed" should appear.