Skip to content

Finds solutions to the knights-n-knaives problem using haskell

License

Notifications You must be signed in to change notification settings

Ebanflo42/knights-n-knaves

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kights-n-knaves

Finds solutions to any knights-n-knaves puzzle using Haskell.

A knight always tells the truth and a knave always lies.

Usage

Assuming you have Haskell's stack and ghc installed, you can clone this repository and run stack build and then stack exec knights-n-knaves-exe. Here is an example session:

/path/to/repo $ stack exec knights-n-knaves-exe
Gwen says (Art is a knight) iff (Lance is a knight)
Art says Gwen is a knave
solve

Solution 1:
  Knights: Gwen
  Knaves: Art, Lance
Solution 2:
  Knights: Art
  Knaves: Gwen, Lance
quit
/path/to/repo $

Currently, the logical connectives not, and, or, if, and iff are supported.

About

Finds solutions to the knights-n-knaives problem using haskell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published