forked from jm1021/student
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The Snake game implementation was refactored for better readability, maintainability, and consistency:
Consolidated repetitive DOM event setup into loops (new_game + setting_menu).
Simplified direction change logic (opposite direction check with modulo).
Replaced verbose wall-wrapping logic with clean modulo arithmetic.
Improved addFood() to ensure clarity and avoid infinite loops.
Reduced repetition in screen display toggling.
Used modern JavaScript best practices (const/let, arrow functions, clean class methods).
Added minor CSS polish (spacing, label styling, hover consistency).
These changes improve maintainability while keeping game behavior identical.
Metadata
Metadata
Assignees
Labels
No labels