mauricioaniche / sem-pacman-python

PacMan game used in the Software Engineering Methods (CS minor, TU Delft)
12 stars 22 forks source link

In the refactored code the ghosts move even when an invalid key is pressed #4

Closed iamlucasvieira closed 4 years ago

iamlucasvieira commented 4 years ago

When an invalid key is pressed, function play() returns (False, False), and the ghosts are still moved on the board. In the case a user has entered a wrong key, wouldn't it be better if the ghosts stay in the same position?

Perhaps this could be fixed by adding an additional return value in function play(). E.g. The invalid_key variable could be returned as a third value and added into the if statement that decides if the ghosts should be moved or not.

mauricioaniche commented 4 years ago

Seems like a good feature to me! On the other hand, in a real game, if you press the wrong button, the other actors (eg, ghosts) don’t really wait for you to press the right buttons!

On Thu, 24 Sep 2020 at 19:33, Lucas dos Santos notifications@github.com wrote:

When an invalid key is pressed, function play() returns (False, False), and the ghosts are still moved on the board.

In the case a user has entered a wrong key, wouldn't it be better if the ghosts stay in the same position?

Perhaps this could be fixed by adding an additional return value in function play().

E.g. The invalid_key variable could be returned as a third value and added into the if statement that decides if the ghosts should be moved or not.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mauricioaniche/sem-pacman-python/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAYTTAGNUO7GFHNRJ5LSDLSHN7FDANCNFSM4RYSOOBA .

--

Maurício Aniche Delft University of Technology http://www.mauricioaniche.com

iamlucasvieira commented 4 years ago

That's true! In the oop version the ghosts only move if a valid key is entered. Do you think it's worth making the refactored code behave the same way? If yes, I can make the changes.

mauricioaniche commented 4 years ago

It’s definitely a good exercise! Go for it!

On Fri, 25 Sep 2020 at 12:39, Lucas dos Santos notifications@github.com wrote:

That's true!

In the oop version the ghosts only move if a valid key is entered.

Do you think it's worth making the refactored code behave the same way?

If yes, I can make the changes.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/mauricioaniche/sem-pacman-python/issues/4#issuecomment-698858173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAYTTEFJOW6E6JEPPCQCL3SHRXPDANCNFSM4RYSOOBA .

--

Maurício Aniche Delft University of Technology http://www.mauricioaniche.com