Skip to content

IhorLazarkov/sudoku-game

Repository files navigation

🧩 Modern Sudoku

A high-performance, architecturally sound Sudoku engine built with React 19, TypeScript, and Tailwind CSS v4.

🏗️ Project Architecture

This project follows a Clean Architecture pattern to ensure a strict separation of concerns between the mathematical engine and the user interface.

Project Architecture

Folder Breakdown

  • src/ui: React components and layout. Purely responsible for rendering and capturing user intent.
  • src/store: Reducers managing game state transitions via useActionState and useReducer.
  • src/service: Orchestrates high-level game rules and board initialization.
  • src/logic: Mathematical core for board generation and validation algorithms.
  • src/model: Domain entities and TypeScript interfaces.

🔄 State Management Flow

The game leverages React 19's useActionState for asynchronous board updates and useReducer for tracking game completion status.

State Flow


🧪 Testing Strategy

The project maintains a high standard of reliability through a multi-layered testing approach:

  • Logic Tests (src/__tests__/logic.test.ts): Unit tests for the Sudoku generation engine using Jest.
  • UI Tests (src/__tests__/ui.test.tsx): Integration tests using React Testing Library and Jest.
    • State Mocking: Reducers are mocked to verify UI transitions (e.g., verifying the "WIN" state).
    • User Simulation: Testing cell selection and digit input behavior.

🚀 Tech Stack


🛠️ Getting Started

Prerequisites

  • Node.js (Latest LTS recommended)

Installation

# Clone the repository
git clone <your-repo-url>

# Install dependencies
npm install

# Start development server
npm run dev

Running Tests

# Run all logic and component tests
npm test

Built with ❤️ and clean code principles.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors