You solve the puzzle by translating text on them into logical formulas (that has to be done by hand). The formulas can use named variables and operators & (and), | (or), = (is equal to), not(), and basic arithmetics like +,-,etc. Operator precedence is the usual: functions(such as not()), ^(power), (*,/), (+,-) (<,>,=) (&,|) (;). You can use brackets to force a specific order. "If" condition can be represented as: "if (statement1) then (statement2)" -> "not(statement1) | statement2" Expression result is evaluated to true if it's non-0 You can use 1 and 0 or "true" and "false" The variables are: blue1(2,3), white1(2,3), black1(2,3) So "top statement on the black box is true" translates to "black1" "black box has two false statements" -> "not(black1) & not(black2)" or "black1+black2=0" gems_in variable specifies where the gems are, e.g. "the gems are in the white box" -> "gems_in=white" (you can also use 0,1,2 instead of blue,white,black in this comparison) Additionally, you can also access conditions on the box with gems via boxgems1(2,3) "second statement on the box with the gems is false" -> "not(boxgems2)" Since boxes can have variable amounts of statements and you don't know which one has them, you can use boxgems_true (the amount of true statements on the box with gems) and boxgems_count (total amount of statements on the box with gems) "the gems are in a true box" -> "boxgems_count & boxgems_true=boxgems_count" (you can skip "boxgems_count &" if there are no blank boxes) In advanced cases, you can similarly access data on boxes *without* gems, via box1(2)nogems1(2,3), box1(2)nogems_true, box1(2)nogems_count "the gems are in *the only* true box" -> "boxgems_count & boxgems_true=boxgems_count & not(box1nogems_count & box1nogemstrue=box1nogems_count) & not(box2nogems_count & box2nogems_true=box2nogems_count)" In fringe cases that reference the amount of words in statements for instance, you'd have to check that manually. So if you see that only the white box has a statement with six lettes "the gems are in a box that has a 6-letter statement" -> "gems_in=white" (this is the contents of readme.txt)