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!
The above is the detailed content of Tetris Game Development – Seeking Coding Advice and Feedback. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn