The Q++ World Selector is a new algorithm built within the Q++ language and runtime that demonstrates how symbolic factors can be transformed into mathematical signatures and used to explore probabilistic versions of worlds.
Prime-Based Semantic Signatures
Each symbolic factor, such as “cat,” “hat,” or “blue,” is assigned a unique prime number. Candidate worlds are then represented as sparse prime factorizations. For example:
- cat = 2
- hat = 3
- cat with a hat = 2 × 3 = 6
This representation ensures that the order of factors does not matter—only the factors themselves. Independent factors combine into meaningful composites, while shared primes reinforce one another.
Gaussian Spectral Scoring
The algorithm evaluates the likelihood of different candidate worlds by converting prime signatures into frequency spectra. Each prime corresponds to a frequency defined as ω = k · ln(p). These spectra are then compared using a Gaussian overlap kernel.
Several tunable parameters influence the scoring process:
- Sigma (σ): spectral sensitivity
- Lambda (λ): weight of relational context
- Temperature (τ): sharpness of the probability distribution
- k: number of Monte Carlo shots in CPU mode
Frequencies that align reinforce one another, increasing the probability that the corresponding world will be selected.
Dual Execution Backends
The World Selector supports two execution modes:
- CPU Backend: produces deterministic scores and reproducible categorical samples.
- QPU Simulator Backend: transforms probabilities into amplitudes for simulated Born-rule measurements. This backend is designed to connect to alternative simulators via environment variables, making it flexible for different runtime environments.
Practical Applications
Although the World Selector is inspired by quantum principles and framed in terms of “worlds,” it has a variety of practical applications:
- Decision-making with overlapping criteria: ranking candidates, projects, or features by how strongly they align with desired factors.
- Generative creativity systems: guiding probabilistic combinations in art, music, or writing so results remain coherent while still novel.
- Recommendation engines: encoding user interests as factors and sampling content that overlaps most significantly with them while maintaining diversity.
- Knowledge graph navigation: retrieving contextually relevant results by favoring paths with overlapping semantic factors.
- Scenario simulation: biasing exploratory models in economics, climate, or games toward consistent but still varied outcomes.
- Quantum computing research: serving as a testbed for hybrid algorithms where categorical features are mapped into amplitudes for quantum simulation.
In each case, the algorithm’s strength lies in combining symbolic independence with probabilistic overlap, enabling systems to rank, sample, and explore possibilities in a principled way.
Building and Running
To build the project, configure it with CMake and Ninja:
cmake -S . -B build -G Ninja
cmake --build build --target worlds_lib
cmake --build build --target world_picker
Once built, the command-line interface can be run with the desired backend and parameter values:
./build/world_picker --backend cpu --k 128 --sigma 1.0 --lambda 0.5 --temperature 1.0
The tool reports the chosen backend, the effective hyperparameters, the scores for each candidate world, the CPU and QPU probabilities, and the underlying prime-based signatures.
Further Information
Documentation and installation instructions are available at:
https://sefunmi4.github.io/aoh-guild-house/projects/qpp
The full source code is available at:

Leave a Reply