Vos commentaires

Здравствуйте!

Вы не могли бы сказать, какой это браузер / операционная система? Не могу воспроизвести проблему, к сожалению.

Hi!

You might be right about that! Moreover, I think most patterns violate some of his principles, for example:

Simple is better than complex.
Complex is better than complicated.

Still, for better or worse, the patterns are used universally and not just in the Python world.

Thank you, Daniel! I'm glad that you enjoyed my work!

Hi!

I think the closest thing to what you wanted is the https://gameprogrammingpatterns.com/

I'm not aware of a more game-dev-focused book/resource on patterns.

Hi!

Yes, it's already in my plans (I can't have any time estimates, though).

The code has become more compact, but I don't think there was any improvement in readability. In fact, it becomes harder to grasp what this method is doing because:

1. You now have a break in mental context - you have to travel mentally to methods calcOcKeyNum and addToObject to check what they do (it's still not obvious.)

2. The addToObject method is not self-contained, which makes it even harder to grasp its logic.

Yeah, I think a lot about it as well. All the refactoring is only needed for us, humans. If AI will ever learn to code, I doubt it ever needs to refactor anything at all, it will comprehend the ugly code just fine: "it's good as long as it works".

Hi!

To be honest with you, I don't see a reason to change something in it. Yes, it may look a little messy, but so does the format of the input. Without changing the input and possibly, the output as well, this method wouldn't become much better. If there are others similar to this one, then maybe it's worth making some sort of data mapping. Otherwise, you would see similar lines in my own code.