A checkers (draughts) game implementation in C# .NET 9.0 with both console and web interfaces. Features configurable board sizes (4x4 to 32x32), Human vs Human, Human vs AI, and AI vs AI gameplay with Minimax algorithm.
- .NET 9.0 SDK
- SQLite (included with .NET)
Console Application (recommended for first-time users):
cd /Users/aleksandrsmirnov/git/checkers
dotnet run --project ConsoleAppThe console app provides a menu-driven interface where you can:
- Create new games with custom board sizes
- Choose between Human and AI players
- Save and load games
- Switch between Database and FileSystem storage
Web Application:
cd /Users/aleksandrsmirnov/git/checkers
dotnet run --project WebAppThen navigate to the URL shown in the console (typically http://localhost:5000).
DATABASE_URL - Path to SQLite database file (optional for ConsoleApp, required for WebApp)
Example:
export DATABASE_URL=/Users/yourusername/checkers.db
dotnet run --project ConsoleAppIf not set, ConsoleApp uses a default path. WebApp uses the connection string in WebApp/appsettings.json.
Initialize the database (first time only):
dotnet ef database update --project DAL.Db --startup-project ConsoleAppThis creates the SQLite database with the required schema (CheckersOption, CheckersGame, CheckersGameState tables).
The application supports two storage strategies:
-
Database (SQLite) - Uses Entity Framework Core
- Required for WebApp
- Optional for ConsoleApp (selected via menu)
-
FileSystem (JSON) - Stores data in local directories
- ConsoleApp only
- Creates
./options/,./games/,./states/directories automatically - No database setup required
- Customizable board sizes: 4x4 to 32x32 (width and height must be even)
- Named game configurations for quick setup
- Human - Interactive play via keyboard (console) or mouse (web)
- AI - Computer opponent using Minimax algorithm (depth 3)
- Standard checkers rules (draughts)
- Diagonal movement only
- Mandatory captures (forced eating)
- Chain captures (multiple jumps in one turn)
- King promotion when reaching opposite end
- Kings can move unlimited distance diagonally
- Save/load games mid-play
- Game history tracking with timestamps
- Winner detection and recording
- Auto-refresh for AI turns in web interface
- Arrow Keys - Navigate the board
- Enter - Select piece, then select destination
- Menu Navigation - Use arrow keys and Enter to navigate menus
# Build entire solution
dotnet build Checkers.sln
# Clean build artifacts
dotnet clean
# Restore NuGet packages
dotnet restoreCreate a new migration:
dotnet ef migrations add MigrationName --project DAL.Db --startup-project ConsoleAppApply migrations:
dotnet ef database update --project DAL.Db --startup-project ConsoleAppRemove last migration:
dotnet ef migrations remove --project DAL.Db --startup-project ConsoleApp- Domain - Core entities and enums
- GameBrain - Game logic, move validation, AI implementation
- DAL - Data access interfaces
- DAL.Db - Entity Framework Core/SQLite implementation
- DAL.FileSystem - JSON file-based storage
- ConsoleUI - Console rendering with Spectre.Console
- MenuSystem - Reusable console menu framework
- ConsoleApp - Main CLI application
- WebApp - ASP.NET Core Razor Pages web interface
- MenuTestApp - Menu system testing utility
- .NET 9.0
- Entity Framework Core 9.0
- SQLite
- Spectre.Console (console UI)
- ASP.NET Core Razor Pages
- Bootstrap (web UI)
The project follows a layered architecture:
- Domain Layer - Entities and enums
- Data Access Layer - Repository pattern with two implementations
- Business Logic Layer - Game rules, AI, UI logic
- Presentation Layer - Console and web applications