Alternative on the Island of Knights and Knaves

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

An alternative is a person who alternatively tells the truth and a lie. That is, if his statement is true, his next statement is false. Once an alternative visited an island in which each inhabitant is either a "knight" or a "knave".

[more]

In this problem there are inhabitants, denoted by A, B, C, … . The alternative makes statements, and the problem is to infer who is a knight and who is a knave.

[less]

Contributed by: Izidor Hafner (December 2012)
Open content licensed under CC BY-NC-SA


Snapshots


Details

The algorithm makes random statements about inhabitants and checks that the solution is unique. If after 50 attempts it fails, a message is returned.



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.
Send