a knights and knaves puzzle generator
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Another JavaScript learning project. A live example can be found here.

The page and scripts in "knaves" generate interactive "knights and knave" puzzles, as found in “What is the Name of this Book?” by Raymond M. Smullyan.

See this blog post for more about the knight and knave problems that these scripts generate.

Code in the knaves repo generates problems where all the islanders are knights or knaves, the puzzles are always completely solvable, and the statements made by knights and knaves are restricted to three basic types (Accusaions/Affirmations, Sympathetic/Antithetic, and "Knave Conjunctions"), as described in the blog post.

There are a variety of puzzle 'topologies' generated for each difficulty selection - a large number of distinct puzzles are possible.

Using the main page, you can choose the difficulty of the puzzle: puzzle difficulty selection

An example of an easy puzzle is:

puzzle example

The page invites you to catgegorize each islander as a knight or knave, and submit your solution:

solution input

If you wish, you can the reasoning behind a possible solution.

reasoning display