Classic Snake game built with C# for the terminal, demonstrating OOP principles, game loops, and collision detection algorithms.
- 🎮 Classic snake gameplay with smooth controls
- 🎯 Score tracking system
- ⚡ Progressive difficulty (speed increases)
- ⏸️ Pause functionality
- 🎨 Clean ASCII art interface
- 📊 Real-time stats display
- Language: C# 10.0
- Framework: .NET 10.0
- Platform: Cross-platform (Windows, macOS, Linux)
- .NET 10.0 SDK or later
# Clone the repository
git clone https://github.com/ky-cx/snake-game-csharp.git
# Navigate to project directory
cd snake-game-csharp
# Run the game
dotnet run- W / ↑ - Move Up
- S / ↓ - Move Down
- A / ← - Move Left
- D / → - Move Right
- P - Pause/Resume
- Q - Quit
- Control the snake to eat food (★)
- Each food increases score by 10 points
- Snake grows with each food eaten
- Speed increases every 50 points
- Avoid hitting walls or yourself!
- Encapsulation of game state and logic
- Type-safe direction handling with enums
- Clean separation of concerns
- Collision Detection: O(n) self-collision, O(1) boundary checks
- Game Loop: Event-driven with fixed time steps
- Snake Movement: Deque-like operations using List
- Comprehensive XML documentation
- SOLID principles applied
- Clean, maintainable code structure
- Lines of Code: ~400
- Development Time: ~6 hours
- Complexity: Medium (junior-mid level)
This project demonstrates several key software engineering concepts:
- OOP Principles: Encapsulation, abstraction, separation of concerns
- Algorithm Skills: Collision detection, state management
- Game Development: Game loop, real-time input handling
- Code Quality: Documentation, naming conventions, clean code
Perfect for technical interviews to discuss:
- Design patterns and architecture
- Performance optimization strategies
- Testing approaches
- Potential enhancements
- High score persistence
- Multiple difficulty levels
- Sound effects
- Multiplayer mode
- Power-ups and obstacles
Conghui Xu
- 📧 Email: hsuconghui@gmail.com
- 💼 LinkedIn: linkedin.com/in/cx27
- 🐙 GitHub: @ky-cx
- 🌐 Portfolio: ky-cx.github.io
This project is open source and available under the MIT License.
Built with 💚 by Conghui Xu