A C# implementation of classic card games featuring clean architecture, testable logic, and a desktop user interface. This project demonstrates modern software development practices while providing entertaining and familiar card game experiences.
CardGames is designed to implement various classic card games (such as Solitaire, Poker, and others) with a focus on:
- Clean Architecture: Core game logic is completely separated from UI code
- Testable Design: All game logic is unit tested and easily verifiable
- Modular Structure: Each game variant is modular and reusable
- Desktop Experience: Rich WPF-based user interface for Windows
The solution is organized into three main projects:
- CardGames.Core (.NET Standard 2.1): Contains the core game logic, card definitions, deck management, and game rules
- CardGames.Tests (.NET 8.0): Comprehensive unit tests for all core functionality
- CardGames.WPF (.NET 8.0 Windows): Windows Presentation Foundation UI using MVVM pattern
- Card System: Complete playing card implementation with suits and numbers
- Deck Management: Standard 52-card deck with shuffling capabilities
- Solitaire Game: Full implementation of Klondike Solitaire with complete rule validation
- Unit Testing: Comprehensive test coverage for all core functionality
- .NET 8.0 SDK or later
- Windows (for WPF UI components)
# Clone the repository
git clone https://github.com/samsmithnz/CardGames.git
cd CardGames
# Build the solution
dotnet build src/CardGames.sln
# Run tests
dotnet test src/CardGames.Tests/CardGames.Tests.csproj# Run the WPF application (Windows only)
dotnet run --project src/CardGames.WPF/CardGames.WPF.csprojThe repository includes a complete implementation of Klondike Solitaire. For detailed rules, setup instructions, and strategy tips, see the Solitaire Rules Documentation.
Key features:
- Traditional 7-column tableau with alternating color placement
- 4 foundation piles building from Ace to King by suit
- Stock and waste pile mechanics with automatic reset
- Complete move validation and win condition checking
- Language: C#
- Framework: .NET 8.0 / .NET Standard 2.1
- UI Framework: Windows Presentation Foundation (WPF)
- Testing: MSTest
- CI/CD: GitHub Actions
- Architecture Pattern: MVVM (for UI), Clean Architecture (overall)
Contributions are welcome! Please ensure that:
- All new public methods and classes include XML documentation
- Unit tests are written for new functionality
- Code follows the established C# conventions
- UI logic remains separate from core game logic
This project is licensed under the MIT License - see the LICENSE file for details.