0

I have generated the following truth table for the following logic puzzle: https://brilliant.org/problems/from-signup/the-boxes/no-group/no-input/?signedup=true#=

It is for the car in the box problem, explained below: here are 3 boxes, exactly one of which has a car. You can keep the car if you pick the correct box!

On each box there is a statement, exactly one of which is true.

Box A: The car is in this box. Box B: The car is not in this box. Box C: The car is not in box A.

Which box has the car?

I want to be able to demonstrate that it is possible to derive the answer logically and systematically using truth tables and have devised the following one. The answer to the problem, according to the below table, shows that it has to be the SECOND ROW, because only in that one is there ONE single TRUE statement derived.

My question is - is there a simpler way to construct the truth table, and is this a truth table that has been correctly devised?

What is a starting point for coding this in Python for demonstration purposes?

enter image description here

braX
  • 11,506
  • 5
  • 20
  • 33
Compoot
  • 2,227
  • 6
  • 31
  • 63
  • No. Yes. No: there is no simpler way. Yes: both your method and your result are correct. Nice picture. Do you have any questions about some actual code? – Andrey Tyukin Feb 05 '18 at 21:57
  • Andrey - thank you. I'd be interested in the best way to go about coding this for demonstration purposes. e.g. what would the inputs and outputs be? (preferred language: Python) – Compoot Feb 05 '18 at 22:10
  • Write a little python script that takes no inputs and prints out a single line with the solution. Asking "what is a starting point for coding" is not a very specific question, because the answer is always the same: "An empty text file is a pretty decent starting point for any programming project". Try to write down a few lines, then tell us where you got stuck. Hint: it took me 5 lines in a language which required 2 lines for closing braces. It shouldn't take you much more lines in Python. Show us an attempt, some piece of code, even if it's broken, then we have something concrete to discuss. – Andrey Tyukin Feb 05 '18 at 22:27

0 Answers0