FranklinChen / annoying-boxes-puzzle

Solution to annoying boxes puzzle at http://blog.plover.com/math/logic/annoying-boxes.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solve an annoying boxes puzzle

Build Status

Solve this annoying boxes puzzle:

There are two boxes on a table, one red and one green. One
contains a treasure. The red box is labelled "exactly one of the
labels is true". The green box is labelled "the treasure is in
this box."

Can you figure out which box contains the treasure?

The followup blog post with solution

Read Mark-Jason Dominus's writeup of the solution.

Print solution

I implemented the solution in Haskell.

You can run it with the GHCi interpreter with:

$ runhaskell src/AnnoyingBoxesPuzzle.hs

Or you can compile to native code and run that (overkill for this little program with no external library dependencies):

$ cabal build
$ cabal run

The output is crude but should be self-explanatory.

Explanation of the solution

TODO

About

Solution to annoying boxes puzzle at http://blog.plover.com/math/logic/annoying-boxes.html

License:Other


Languages

Language:Haskell 100.0%