Skip to content

Korgys/sutom-resolver

Repository files navigation

Sutom Resolver

Build Status Last Commit Coverage Quality Gate Status Lines of Code Duplicated Lines (%) Bugs Vulnerabilities Reliability Rating Security Rating Maintainability Rating .NET Platform License

Overview

Sutom Resolver is a .NET console application that helps solve Sutom-style word puzzles.

It is built around a solver pipeline that can:

  • generate a candidate guess from a known pattern
  • evaluate guess feedback using the Sutom rules
  • refine the candidate list after each response
  • simulate thousands of games to compare solver strategies

The repository currently contains several solver versions under SutomResolver/solver/:

  • v1 - baseline solver
  • v2 - improved solver logic
  • v3 - heuristic-driven solver
  • v4 - current solver used by the entry point

Key Features

  • Interactive solving from a partially known pattern
  • Game simulation for benchmarking solver performance
  • Word normalization to handle accents consistently
  • Dictionary-based candidate filtering
  • Multiple solver implementations for experimentation
  • Automated tests and CI with coverage and SonarCloud analysis

Repository Structure

.
|-- SutomResolver/              # Console app
|   |-- Program.cs              # Application entry point
|   |-- Simulator.cs            # Interactive mode and game simulation
|   |-- SutomHelper.cs          # Word loading and response evaluation helpers
|   |-- data/fr.txt             # French dictionary used by the solver
|   |-- solver/                 # Solver implementations
|-- SutomResolver.Tests/        # MSTest test project
|-- .github/workflows/          # CI workflow
|-- coverlet.runsettings        # Coverage configuration
`-- SutomResolver.sln           # Visual Studio solution

Requirements

.NET SDK 11.0

Getting Started

Clone the repository

git clone https://github.com/Korgys/sutom-resolver.git
cd sutom-resolver

Build the solution

dotnet build

Run the application

cd SutomResolver
dotnet run

CLI Usage

The application is intended to be used from the command line.

Interactive solve

Enter the known pattern when prompted, for example:

L___

You then answer each proposed guess using the Sutom feedback format:

  • _ or ? for absent letters
  • + for letters present but in the wrong position
  • the letter itself when it is correctly placed

What you enter in the CLI

  • Start with the known pattern of the hidden word.
  • After each suggested guess, enter the feedback pattern returned by the game.
  • Keep following the prompt until the solver finds the word or no candidates remain.

Example

Entrez le pattern du mot a trouver (ex: L___) :
L___
Le solveur propose : LION
Entrez le pattern du mot a trouver :
L++_

The exact guesses depend on the active solver and dictionary state.

Run a simulation

The project also supports simulation through the Simulator<T> class. The current entry point uses the interactive mode, but the codebase can be extended to run batch simulations for solver comparison.

How It Works

The solver uses a dictionary-driven workflow:

  1. Load the French word list from SutomResolver/data/fr.txt.
  2. Normalize words to uppercase without diacritics.
  3. Filter candidates by word length and any known constraints.
  4. Produce the next guess from the active solver implementation.
  5. Apply the Sutom response pattern to shrink the candidate set.
  6. Repeat until the word is found or the solver runs out of attempts.

The response evaluator in SutomHelper.GetResultFromGuess follows the same two-pass logic used by word games:

  • exact matches are marked first
  • misplaced letters are marked only if occurrences remain available

Interactive Mode

The default application flow is interactive.

Example session:

Entrez le pattern du mot a trouver (ex: L___) :

If you enter a partially known pattern, the solver will keep proposing guesses until:

  • the word is found
  • the candidate list is exhausted
  • the response you provide eliminates all possibilities

Simulation Mode

Simulator<T> is designed to benchmark solver quality over many random games.

It tracks:

  • number of games played
  • wins
  • losses
  • average turns
  • runtime in milliseconds

This is what the test project uses to compare solver versions.

Roadmap

  • Improve solver performance
  • Add richer CLI options for batch solving and simulations
  • Publish coverage and quality badges with live project metrics

Tests

Run the full test suite with:

dotnet test

The test project currently checks:

  • success rate for solver versions v1, v2, and v3
  • relative improvement between solver generations

Word List

The solver relies on the French word list stored in:

SutomResolver/data/fr.txt

If you want to adapt the project to another language or dictionary:

  • replace the word list
  • keep the normalization behavior aligned with your target language
  • review the solver heuristics and test expectations

Extending the Solver

The cleanest extension point is a new solver implementation under:

SutomResolver/solver/

To add a new strategy:

  1. Implement the ISolver contract.
  2. Add your solver in a new folder or version namespace.
  3. Update the entry point if you want it to become the default.
  4. Add tests that compare it against the existing versions.

License

This project is licensed under the MIT License. See LICENSE.

About

IA permettant de résoudre facilement des SUTOM/MOTUS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages