Skip to content

TheAlbatross279/Knights-Knaves

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Knights and Knaves is a logic puzzle that deals with a mysterious island of inhabitants who are either knights or knaves. The ones who are knights always tell the truth, while the inhabitants who are knaves always tell lies. The puzzle is to solve which of the inhabitants are knaves and which are knights. This code solves the problem when there are only two inhabitants in question. The correct input looks as follows:

'A very special island is inhabited only by knights and knaves. Knights always tell the truth, and knaves always lie.

You meet two inhabitants: Zoey and Mel. Zoey tells you that Mel is a knave. Mel says, `Neither Zoey nor I are knaves.'

Can you determine who is a knight and who is a knave?'

More examples following valid input come from this site: http://philosophy.hku.hk/think/logic/knight.php

About

A program that solves the Knights & Knaves puzzle with two inhabitants.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages