Add player names to snake display

Show human-readable player names instead of player IDs in both desktop
and web clients. Player names are now stored in the Snake model and
synchronized across all clients.

Changes:
- Added player_name field to Snake model
- Updated create_snake() to accept player_name parameter
- Desktop client shows "YOU:" or "PlayerName:"
- Web client shows "You (Name)" or "Name"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vladyslav Doloman
2025-10-04 17:21:53 +03:00
parent b28d78575f
commit 97d6df1896
6 changed files with 16 additions and 8 deletions

View File

@@ -6,7 +6,10 @@
"Bash(python:*)",
"Bash(pip install:*)",
"Bash(git log:*)",
"Bash(git add:*)"
"Bash(git add:*)",
"Bash(git commit -m \"$(cat <<''EOF''\nImplement stuck snake mechanics, persistent colors, and length display\n\nMajor gameplay changes:\n- Snakes no longer die from collisions\n- When blocked, snakes get \"stuck\" - head stays in place, tail shrinks by 1 per tick\n- Snakes auto-unstick when obstacle clears (other snakes move/shrink away)\n- Minimum snake length is 1 (head-only)\n- Game runs continuously without rounds or game-over state\n\nColor system:\n- Each player gets a persistent color for their entire connection\n- Colors assigned on join, rotate through available colors\n- Color follows player even after disconnect/reconnect\n- Works for both desktop and web clients\n\nDisplay improvements:\n- Show snake length instead of score\n- Length accurately reflects current snake size\n- Updates in real-time as snakes grow/shrink\n\nServer fixes:\n- Fixed HTTP server initialization issues\n- Changed default host to 0.0.0.0 for network multiplayer\n- Improved file serving with proper routing\n\nTesting:\n- Updated all collision tests for stuck mechanics\n- Added tests for stuck/unstick behavior\n- Added tests for color persistence\n- All 12 tests passing\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")",
"Bash(git push:*)",
"Bash(git commit:*)"
],
"deny": [],
"ask": []