# Pygame Sudoku

> Minimal Sudoku game prototype built with Pygame featuring backtracking solver, puzzle generation, and keyboard/mouse input. Use when asked to play Sudoku, test the Sudoku game, or debug puzzle logic.

- Skill: `fnaith/pygame-sudoku` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add fnaith/pygame-sudoku`
- Raw SKILL.md: https://api.skillmd.com/api/skills/fnaith/pygame-sudoku/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: fnaith (https://skillmd.com/u/fnaith)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/fnaith/pygame-sudoku

---


# Pygame Sudoku

A minimal Sudoku game prototype built with Pygame.

## When to Use

- Play a game of Sudoku
- Test or debug the Sudoku game logic
- Verify game rules: number placement, conflict detection, backtracking solver, puzzle generation

## Prerequisites

- Python 3.10+
- Pygame (see requirements.txt)

## Usage

```
python pygame_sudoku.py [--difficulty DIFFICULTY] [--cell-size N] [--log-level LEVEL]
```

### Options

| Option | Default | Description |
|--------|---------|-------------|
| `--difficulty` | medium | Puzzle difficulty: easy, medium, hard |
| `--cell-size` | 60 | Cell size in pixels |
| `--log-level` | INFO | Logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL |

### Controls

- **Arrow keys**: Move selection
- **Mouse click**: Select cell
- **1-9 keys**: Place number in selected cell
- **Backspace/Delete**: Clear selected cell
- **R key**: Reset puzzle (same difficulty)
- **N key**: New puzzle (same difficulty)
- **ESC / Close window**: Exit

## Game Rules

- Fill the 9x9 grid so each row, column, and 3x3 box contains digits 1-9
- Pre-filled clues are fixed (shown in black)
- Player-entered numbers appear in gray
- Conflicts are highlighted in red
- Completing the grid without conflicts wins the game

