Puzzler - Puzzle Solver Comparison
A command-line tool for comparing three approaches to solving logic puzzles: CLIPS-only, LLM-only, and Hybrid.
Compare CLIPS rule-based constraint solving against LLM reasoning side by side, then combine both in a hybrid approach for real puzzle problems.
Scenarios: sudoku · set-game · compare
Edition
Section titled “Edition”Pro — requires a Pro (or trial) entitlement.
What this demonstrates
Section titled “What this demonstrates”Difficulty: Advanced ♦🏁 · LLM · CLIPS · Solver
- Summary: Multi-approach puzzle solver comparing CLIPS, LLM, and hybrid strategies
- Scenario: Compare CLIPS rule-based, LLM reasoning, and hybrid approaches for solving logic puzzles
tech_tagsin manifest:CLIPS, LLM, Solver— example idpuzzlerinconformance/examples_manifest.json.
Prerequisites
Section titled “Prerequisites”- SDK: Use an installed SDK tree (
NXUSKIT_SDK_DIR,NXUSKIT_LIB_PATHas needed);test-examples.shresolves Go/Rust/Python deps from that tree only — see README.md,scripts/setup-sdk.sh, andscripts/test-examples.sh. - Languages in this example: go, rust (paths under this directory; Python may live under a sibling
python/or shared reference per Language Implementations).
Real-World Application
Section titled “Real-World Application”Educational puzzle solver, constraint programming tutorial.
Requirements
Section titled “Requirements”Edition: nxusKit Pro
This example requires the Pro edition of nxusKit. Purchase Pro or start a free 30-day trial (automatic on first Pro feature call).
Technologies
Section titled “Technologies”Solver
CLIPS integration path (CLIPS-only / hybrid modes)
Section titled “CLIPS integration path (CLIPS-only / hybrid modes)”The Go CLIPS solver path uses provider chat (go/clips_wire.go mirrors ClipsInput / ClipsOutput JSON). It is not the Session API (nxuskit.ClipsSession). See conformance/clips-json-contract.json and nxusKit SDK sdk-packaging/docs/rule-authoring.md — ClipsInput JSON Reference (#clipsinput-json-reference; bundle: docs/rule-authoring.md).
Language Implementations
Section titled “Language Implementations”| Language | Path | Status |
|---|---|---|
| Rust | rust/ | Available |
| Go | go/ | Available |
Attach an installed SDK (NXUSKIT_SDK_DIR). See the repository README.md and scripts/test-examples.sh.
# From `/examples/apps/puzzler`:cd rust && cargo buildcd go && make buildFeatures
Section titled “Features”- Sudoku Puzzles - Solve Sudoku puzzles of varying difficulty
- Set Game - Find valid sets in Set card game hands
- Three Approaches:
- CLIPS-only: Pure rule-based constraint propagation
- LLM-only: Pure LLM reasoning
- Hybrid: CLIPS primary with LLM fallback for stuck states
- Comparison Mode - Run all approaches and compare results
Installation
Section titled “Installation”cd examples/apps/puzzler/rustcargo build --releasecd examples/apps/puzzler/gomake buildcd examples/apps/puzzler/rust
# Show helpcargo run -- --help
# Solve a Sudoku puzzlecargo run -- sudoku -p easy
# Compare all approaches on Sudokucargo run -- sudoku --compare
# Play Set gamecargo run -- set -p random
# Compare approaches on Set gamecargo run -- set --comparecd examples/apps/puzzler/go
# Show help./bin/puzzler --help
# Solve a Sudoku puzzle./bin/puzzler sudoku -p easy
# Compare all approaches./bin/puzzler sudoku --compareCommand Line Options
Section titled “Command Line Options”USAGE: puzzler [OPTIONS] <GAME>
GAMES: sudoku Solve Sudoku puzzles set Find sets in Set game cards
OPTIONS: -p, --puzzle <ID> Puzzle identifier (easy, medium, hard, expert, or custom) -a, --approach <TYPE> Solver approach: clips, llm, hybrid (default: hybrid) -c, --compare Compare all three approaches -v, --verbose Show detailed solving steps -h, --help Show help messageInteractive Modes
Section titled “Interactive Modes”All examples support debugging flags:
# Verbose mode - show raw HTTP request/response datacargo run -- --verbose # Rust./bin/puzzler --verbose # Go
# Step mode - pause at each step with explanationscargo run -- --step # Rust./bin/puzzler --step # Go
# Combined modecargo run -- --verbose --stepOr use environment variables:
export NXUSKIT_VERBOSE=1export NXUSKIT_STEP=1Puzzle Types
Section titled “Puzzle Types”Sudoku
Section titled “Sudoku”Difficulty levels:
- easy - Many given numbers, straightforward solving
- medium - Moderate difficulty
- hard - Requires advanced techniques
- expert - Very few givens, requires backtracking
Set Game
Section titled “Set Game”Find valid sets where each attribute (color, shape, shading, number) is either all the same or all different across three cards.
Example Output
Section titled “Example Output”Sudoku Comparison
Section titled “Sudoku Comparison”=== Sudoku Puzzle: easy ===
Approach | Time | Solved | Moves--------------|---------|--------|-------CLIPS-only | 12ms | Yes | 47LLM-only | 2.3s | Yes | 52Hybrid | 15ms | Yes | 47
Winner: CLIPS-only (fastest)Set Game
Section titled “Set Game”=== Set Game: 12 cards ===
Found 3 valid sets:
Set 1: Red-Oval-Solid-1, Red-Oval-Striped-2, Red-Oval-Empty-3Set 2: Green-Diamond-Solid-1, Purple-Diamond-Striped-1, Red-Diamond-Empty-1Set 3: ...Architecture
Section titled “Architecture”puzzler/├── rust/│ ├── src/main.rs # CLI entry point│ └── Cargo.toml├── go/│ ├── cmd/main.go # CLI entry point│ ├── sudoku.go # Sudoku solver logic│ ├── setgame.go # Set game solver logic│ └── go.mod└── shared/ └── puzzles/ # Puzzle definitions- CLIPS validation rules are in
shared/puzzles/ - LLM solving uses Ollama by default (no API key required)
- Optional: Set ANTHROPIC_API_KEY or OPENAI_API_KEY for cloud providers
Testing
Section titled “Testing”# Rustcd examples/apps/puzzler/rustcargo test
# Gocd examples/apps/puzzler/gogo test -v ./...License
Section titled “License”Part of the nxusKit project.