Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My solution #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

My solution #9

wants to merge 2 commits into from

Conversation

Rejman
Copy link

@Rejman Rejman commented Jul 14, 2022

No description provided.

@@ -66,6 +68,8 @@ class Controller : public IEventHandler

Direction m_currentDirection;
std::list<Segment> m_segments;

bool paused = false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be m_ as other members in this class; please try to follow convention that is used in specific project; it may be different, but usually it is better to follow convention that is used in specific project

if (segment.x == requestedFood.x and segment.y == requestedFood.y) {
requestedFoodCollidedWithSnake = true;
break;
if(!paused){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be better to check this flag in one function (for example in recive() method before calling handleNewFood() instead of putting it here. This way you handle the pause functionality in one function instead of body of other functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants