greerviau / SnakeAI

Train a Neural Network to play Snake using a Genetic Algorithm
MIT License
2.34k stars 553 forks source link

Dont do this #2

Closed degski closed 4 years ago

degski commented 5 years ago
boolean foodCollide(float x, float y) {  //check if a position collides with the food  
     if(x == food.pos.x && y == food.pos.y) {
         return true;
     }
     return false;
}

What about:

boolean foodCollide(float x, float y) {  //check if a position collides with the food    
     return x == food.pos.x && y == food.pos.y;
}

Otherwise cool!

algebric commented 5 years ago

Don't do this, don't do that. Nothing is inherently bad about the previous snippet.

degski commented 5 years ago

Yes, it is, 6 as compared to 3 lines [more mental stress], and the code shows that some basic c-stuff has not been understood.

if ( true )
    return true;
else if ( false )
    return false;

Brilliant coding!

algebric commented 5 years ago

I agree it is shorter and more compact, but being terse might not be always what you want if you prioritize readability of code. I meant for me it this particular issue is more a matter of taste, as neither version would be slower or malfunctioning. But I get your point.

degski commented 5 years ago

You won't pass the job-interview.

algebric commented 5 years ago

If you didn't already notice: it is a hobbyist, non-commercial Snake AI project. It doesn't have to be perfect. And neither does it even have to be of production quality, and your "issue" is more of a malignant nitpicking that any meaningful and constructive input. Just some babbling akin to raising another childish flame war about spaces vs tabulators. Besides, if you were even 20% as competent as you think you are, you would know that either of these two variants would compile to identical machine code. No performance and no readability issue neither. And you would realize the nonsense of judging a complete stranger's ability to be employed based on just two short comments - you must have some self-esteem issues with that toxic mentality, don't you? Job interviews are failed because of more insightful reasons, like wrong algorithmic thinking or lack of experience, not because of some hardly-even verbose syntax as long as it is correct. Wait forward for your first job interview, you will be surprised.

Aazeu commented 5 years ago

Totally agree with algebric! I would go further, it is degski that does not pass the job interview. Do you know that changing a line of code costs 10 times more than writing. In these conditions it is imperative to write a clear and documented code, especially in production. Algebic, I hire you! ;)

degski commented 5 years ago

@Aazeu What about: if ( 0 != 1 ) return true;

if ( true ) return true; does not document anything, it just shows you don't have a clue what you're doing and therefor any code you present to me will have to gone over with a magnifying glass.

You're talking rubbish.

darovic commented 4 years ago

Could we please close this? It adds no value.

And @degski, you know any modern compiler will happily optimise everything you've mentioned in microseconds. We routinely make stylistic choices which leave code slightly less than optimal in its raw form and have negligible impact during and after compilation, whilst improving readability for all developers involved.

Based on your behaviour here, I'd definitely never even work with you as a peer, let alone pay you ;) As for working for you... 🤣

algebric commented 4 years ago

I think the crude and unrefined language is on itself enough to see what kind of person we are dealing with. @degski, you are offensively and ineptly judging the skills and valuability of this project's contributors on the basis of your personal whim, which is fueled by sheer frustration and your deceptive sense of entitlement. It's a farce how you are teaching us with that patronizing tone how we are being unprofessional basing on a minusculely and insignificantly oververbose line of code, but at the same time you are yourself using horribly distasteful, rude and uncultured language. I already see your moral compass is dreadfully out of its proper alignment and you are lacking basic manners. It a grotesque-like, how dare you teach anyone about professionalism then?

Believe me, even if you were the most skilled programmer in the world, a behavior like this would not be tolerated in any setting, no matter if professional or not. Even Linus Torvalds himself was made to apologize for years his of profanity-laden rants on buggy Linux contributions, and keep in mind Linus is one of the greatest authorities for many programmers and that his concerns themselves were at least justified and valid.

Despite the bad impression I am still eager to constantly learn and have an open mind, so I've checked your repositories since your arrogance screamed that they were going to be stellar, and sadly your arrogance was lying and your repositories are nothing special.

Not that my own repositories here are fantastic. But that's my own problem, and on the other hand you are actively harming the community of volunteers and hobbyists with insulting and toxic remarks. "You're talking rubbish." - do you really think a grown up, well-mannered and educated human being you're ineptly trying to impersonate would behave like this?

In conclusion, your behavior evidently deserves to be punished with some bare bottom spanking! And any potential coworker you would happen to ever work with should be perfectly authorized to give you a wedgie and a noogie on a daily basis!

neocoretechs commented 4 years ago

All of you forgot to check food and pos for null first, you all fail the interview.

degski commented 4 years ago

I think that those who object to my observations should go and read some books, and read some code (of a well written library) and see how it's 'done'. Nobody checks for true and then returns true, it's just plain silly, but admittedly, harmless, it all will be optimized away.

We've had our fun, now closing.