Skip to content

dmackinnon1/knaves

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

knaves

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