# logic game - how would you solve it?

We had the annual team-building event last Thursday, and one of the activities involved solving the logic game/puzzle I transcribed below - which, as I just learned, is similar to the 'Zebra puzzle' and is tagged as 'logic-grid'.

My questions are: what do you think the solution is? How would you expert puzzle solvers solve this type of puzzle in general? Is there any standard or recommended method/technique/approach? Should someone who is not familiar with such games be expected to solve it in a few minutes?

BTW, I did find the solution, but not during the event: later, at home, when I had time to sit down and consider it in a quiet environment, without having to run around like an idiot. Re-reading it now, I see that I could in principle have solved it by simple reasoning, without writing anything down, but I was unable to think clearly. Is it common to become slightly logically impaired when you're distracted, in a hurry or in a noisy environment, or is it just me?

Five friends escape from a city one after the other. Each of them uses a different vehicle to move to a different hiding place.

• Michael escapes second, and he doesn't have an employer.

• David escapes before the person who used a helicopter, but after the person who escaped by car.

• John hides at a friends's place. When John escapes, Nick has already left.

• The last person who escapes uses a segway.

• The person who hides at his brother's uses a helicopter to get there, and it's not Michael.

• The person who escapes by bike hides at a classmate's place.

• Sam escapes by bus.

Where is David hiding?

• "Is it common to become slightly logically impaired when you're distracted" - this is almost the definition of a distraction, surely? Jul 1, 2017 at 21:59

David is hiding

At a classmate's place

The quickest way to notice this is to notice

Only three places are named, friend's brother's, and classmate's. David is not John, and he did not escape by helicopter. This leaves only classmate's place remaining.

It can then be verified

Classmate's place requires David to escape by Bike, we know he doesn't escape by Helicopter or Car from his line, the last person escapes by Segway, and he's not last, and Sam escapes by bus. This leaves only the bike as an available transport method.

• Beat me by minutes lol. Jul 1, 2017 at 13:29

David is hiding:

At a classmates place

Because:

It is the only named location that doesn't match to another friend.

In answer to 'how I would solve it'

If I was concentrating, I would've noticed quite quickly. In this case I began by marking down the named vehicles and locations to each of the friends before I noticed. Wasting time and effectively handing the first correct answer to another user.

David is hiding

at a classmate's place

Because

Who left with Helicopter might be: John or Nick, which means one of them is hiding at his brother.(Nick is hiding at his brother's place and escaped with Helicopter) John is hiding at his friend's place
remain David at his classmate's place

Anyone with logic, by removing false options

David is hiding at the classmate's place. Michael = M, David = D, Sam = S, John = J, Nick = N, Bus = Bu, Bike = Bi, Car = C, Helicopter = H, Segway = Se

Arranging in order,

Michael escapes second. So X M X X X D escapes after the person who used car and after the one who used H

So, D may be at positions 3 or 4. But if D is on 4 then last person must have used H buy it contradicts that the last person used Se

So, D is on 3. So M used C and 4 used H and 5 used Se and apparently 1 is S and he used Bu and clearly D used Bi. And clearly he is hiding at the classmate's place.

• Welcome to Puzzling! You can hide the essential parts of your answer behind spoilertags (so that one needs to hover over them to see them) using >! syntax. Jul 2, 2017 at 15:46

David is hiding at the classmate's.

To solve this with a program, create a statement for each sentence, and an extra one or two if needed. Give each an order, a person, a transport and a place (ignore the "employer"). Each of these has 5 values- add an XPlace and a YPlace since only 3 are mentioned. The statements will contain a set of 1-5 values for each variable. Plus add a set of "before" and "after" sentences. Since XPlace and YPlace are never mentioned, let's say XPlace was inhabited before YPlace to make them unambiguous.

Then repeatedly compare each statement to all the rest and eliminate contradictions. It ends when no contradictions are found or everything is known. Plus note that sentence 1 (S1) being before S2 means means the orders that can work for S1 must be less than max(S2.order).

Two statements are distinct if one or more of their 4 pairs of values (order, person, transport, place) do not intersect (share a value). If 2 are distinct, then any known value of one can't be an option for the other. If S1="Michael or David rode a moped" and S2="Michael walked or flew" then the difference in transportation makes them distinct. Since Michael is the only option in S2, he (or she...) can be removed from S1.

Plus, we have only 4 unknowns, but 7 statements (and we'd add one or more- eg "John... Nick has already left" means Nick left at some point with some transport to some place, and that happened before John left.) If two statements aren't distinct, they're redundant. In this case, any extra options that one has can be removed. If S1="M, D or J took a bike, or car" and "M or D took a bike, car or bus", then these are really the same sentence: "M or D took a bike or car". This is true for this problem, because it doesn't specify "or" clauses- each sentence is about a specific thing and we add the implicit "or". The statement about Nick is that his order was 1,2,3,4 or 5 and took one of the mentioned transports to one of the places.

There are many ways to solve this. I didn't compute the number of simplifications that can happen from the first set of statements, but there were more than 60 total to reduce all the sentences to being known. A "way to solve it" is some ordering of these.