Introduction

Welcome to the landing page for deduce-api, a free, open-source RESTful web service API implementation of a game ruleset. The API is intended to be used as an educational tool, allowing developers to either attempt programmatic or algorithmic solution of the game, or the implementation of user interfaces allowing interactive play, or any other creative implementation you can think of.

The server is (hopefully) currently running and available publicly on port 8080 on this domain (deduce-api.ws). You can implement any client code you like to access the public instance, or you can download the server code from the GitHub repository and run it locally.

There is also a reference algorithmic client implementation available here. This client is written in Node.js, and demonstrates a naive or "brute-force" solution with a best-case scenario of 22 steps to solve. Surely you can find a more clever algorithm.

There is a server status page here so you can check to see if the public api is currently running.

Rules

The point of the game is to apply deductive reasoning in order to solve a secret word puzzle in a manner vaguely similar to a famous pen-and-paper game commonly known as Hangman. Once a player begins a game, it is known as a match. A match begins with the selection of a secret word. The player's task is to deduce the word by asking questions about letters. Secret words must adhere to a set of criteria. Each word must be exactly five letters long, and contain no repeated letters. For the sake of this project, valid words are taken from the official ENABLE Word List project, used by such prominent word games as Scrabble and Words With Friends.

Once a secret word is selected, the letters composing the word are removed from the alphabet, creating a subset. The player then asks which letters remain in the subset one at a time by naming indexes. For example, "what is the letter at index 0?" would be a valid question. If the answer to that question is "A" then the player knows that the letter A is not used in the secret word. If the answer to that question is "C" then the player may deduce that both letters A and B are in the secret word, and may begin solving the puzzle by asking further questions and thinking through anagrams of known letters. The challenge is to solve the puzzle as quickly as possible. A player may not attempt consecutive solutions, an incorrect solution attempt must be followed by an index inquiry prior to a subsequent solution attempt.

The complete list of all possible words is available through the API. This will help with algorithmic solutions.

That's it! Simple rules, but tricky thinking.

Endpoints

When using the public API, all endpoints are relative to the base URL http://deduce-api.ws:8080

There is a WADL file documenting service endpoints available here.

All deduce-api endpoints return data as JSON. Response bodies represent a response entity wrapper, containing status and message values for indicating successful or erroneous invocations, along with an entity. The entity will vary based on the endpoint. The one exception is the listValidWords endpoint, which returns only a JSON list of words.

Example match

The following steps demonstrate how a full match might be played. We begin by creating a match.