WSS is a tool written in C++ for suggesting wordles. It serves two purposes:
- to provide Wordle players with a list of possible moves, and
- to provide the template for a maintainable CMake project.
- C++20 compiler
- CMake 3.16
WSS produces a command-line tool, wordle
, which takes a history of previous
attempts and lists all potentially-winning words.
After playing the following two moves,
you can search for possible WORDLEs:
wordle TALES20010,TEMPO21001
Output:
THROE
TOGUE
TONNE
TOQUE
TORTE
TOWIE
TRODE
TROKE
TRONE
TROVE
WSS builds the wordle
program by consuming a lexicon of 5-letter words,
converting them into C++-encoded data, and then
building them into a program which searches through them for suggestions.
The encoded data takes the form of a Directed Acyclic Word-Graph (DAWG), similar to the one described in the paper, The World's Fastest Scrabble Program (Andrew W. Appel, Guy J. Jacobson, 1988). It allows algorithms to search through the lexicon in a way that avoids much of the duplication one typically finds in a word list. This helps to find solutions in a shorter time.
WSS also aims to demonstrate a simpler way of organising C++ projects.
Many CMake projects couple tools to the build system explicitly. This approach is often brittle, inflexible and overly-complex.
WSS makes effective use of CMake by keeping configuration scripts minimal, declarative and decoupled. In this way, the code can be configured, built and tested against an open set of toolchains, package managers, and other development tools.
The codebase represents multiple CMake targets and thousands of lines of code. Yet, the essential build configuration amounts to just a few hundred lines of CMake, and everything can be built and tested with just two Conan commands, or five vcpkg commands. This is possible because the build system is separate from other aspects of project management, such as toolchain configuration and dependency management. It does one thing well: describing binaries.
The project's CI pipelines demonstrate how to develop maintainable C++ by applying the build system to many tools...
Toolchains:
Package Managers:
Collaboration and CI:
- GitHub+Actions demonstrates CI via a GitHub repository
- GitLab demonstrates CI via a GitLab repository
Analysers:
- AddressSanitizer
- CppCheck static analyser
- Clang Static Analyzer
- Clang-Tidy C++ linter and static analyser
- gcov+ lcov reporting 100% code coverage
- graphviz representation of package and target dependencies
- Include what you use tool to analyze
#include
s - libfuzzer coverage-guided fuzz testing
- pre-commit linting framework with
formatting and correctness checks for:
- Bash
- C++
- CMake
- JSON
- Markdown
- Python
- YAML
- UndefinedBehaviorSanitizer
- Valgrind
WSS is built and tested on Linux and Windows. It is designed to be easy to build and to run with:
- Conan package manager,
- CMake build system generator,
- A C++20-compatible compiler such as Clang, GCC or MSVC.
To build wordle
using Conan on Linux,
-
create an empty build directory,
mkdir -p build cd build/
-
install package dependencies,
conan install --build=missing <path-to-wss>
-
then configure, build, test, and install the program:
conan build <path-to-wss>
-
The program can be found in
package/bin
:./package/bin/wordle
To build wordle
using vcpkg on Linux,
-
create an empty build directory,
mkdir -p build cd build/
-
install vcpkg using these instructions,
git clone https://github.com/Microsoft/vcpkg.git ./vcpkg/bootstrap-vcpkg.sh
-
then configure, build, and test the program:
cmake -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake <path-to-wss> cmake --build . ctest
You can use WSS as the starting-off point for your own C++ project. From the WSS GitHub repository, click the "Use this template" button in order to generate your own repository.