DEV Community

Фёдор Поцелуев
Фёдор Поцелуев

Posted on

1

Tetris Game Development – Seeking Coding Advice and Feedback

Hey everyone!

I’ve recently completed a Tetris game and am currently focusing on refining some parts of the code. I would be grateful for any general coding advice and feedback on how to improve the structure and readability of my code.

In particular, I’ve been concerned about these specific areas:

Functions in the conflict_resolution.c module:

  • The functions side_cells_crossing_prevention, side_boundaries_crossing_, bottom_top_boundaries_crossing_ of the conflict_resolution.c module don't seem to be clean and easy to read code. They used to be a single function. Is there a better way to structure these functions for clarity and maintainability?

Duplicated logic in the conflict_resolution.c module:

  • The conflict_resolution.c module has the functions top_center_conflict, top_right_corner_conflict, right_center_conflict, bottom_right_corner_conflict, bottom_center_conflict, bottom_left_corner_conflict, left_center_conflict and top_left_corner_conflict that seem to have quite a bit of duplicated logic. Additionally, the handle_top_center_conflict, handle_right_center_conflict, handle_bottom_center_conflict, handle_left_center_conflict functions could probably be refactored to reduce repetition. Any advice on how to better consolidate these would be really appreciated!

Here's the link to the full code: https://github.com/FyodorPotseluev/tetris.

You're welcome to join the "Discussions" section of the repository.

Any thoughts or suggestions would be super helpful!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more