Skip to content

johnmcfarlane/wss

Repository files navigation

WSS

GitHub GitLab

Introduction

WSS is a tool written in C++ for suggesting wordles. It serves two purposes:

  1. to provide Wordle players with a list of possible moves, and
  2. to provide the template for a maintainable CMake project.

Requirements

  • C++20 compiler
  • CMake 3.16

Word Search

WSS produces a command-line tool, wordle, which takes a history of previous attempts and lists all potentially-winning words.

Example

After playing the following two moves,

Image

you can search for possible WORDLEs:

wordle TALES20010,TEMPO21001

Output:

THROE
TOGUE
TONNE
TOQUE
TORTE
TOWIE
TRODE
TROKE
TRONE
TROVE

Implementation

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.

Versatility Through Simplicity

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.

Continuous Integration

The project's CI pipelines demonstrate how to develop maintainable C++ by applying the build system to many tools...

Toolchains:

Package Managers:

  • Conan Python-based C++ package manager
  • vcpkg CMake-based C++ package manager

Collaboration and CI:

Analysers:

Instructions

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.

Build and Test (Conan)

To build wordle using Conan on Linux,

  1. create an empty build directory,

    mkdir -p build
    cd build/
  2. install package dependencies,

    conan install --build=missing <path-to-wss>
  3. then configure, build, test, and install the program:

    conan build <path-to-wss>
  4. The program can be found in package/bin:

    ./package/bin/wordle

Build and Test (vcpkg)

To build wordle using vcpkg on Linux,

  1. create an empty build directory,

    mkdir -p build
    cd build/
  2. install vcpkg using these instructions,

    git clone https://github.com/Microsoft/vcpkg.git
    ./vcpkg/bootstrap-vcpkg.sh
  3. then configure, build, and test the program:

    cmake -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake <path-to-wss>
    cmake --build .
    ctest

Use WSS as a Template

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.

Releases

No releases published

Packages

No packages published