# A Space Station 13 complicated escape

After successfully resolving this tricky situation, you, the Captain of the Space Station 13, have ordered what remains of your crew to gather in the escape shuttle. Accompanied by the Security Officer, the Chief Engineer, the Medical Doctor and the Clown, you enter the shuttle and find two additional survivors hidden there: the Roboticist and the Chaplain. Everyone is quite happy to be alive, and you quickly enter the cockpit to start the launching countdown.

But then, the ship A.I. begins talking to you:

Hello Captain. I have some troublesome readings on the situation. It appears
that, despite your previous work, there are still hostile elements in the
shuttle. There is one Syndicate Nuclear Operative that planted a bomb
somewhere; one innocent crewmember that was infected by an alien lifeform,
known as a "Facehugger", and reluctant to seek help; one Rogue Cyborg with a
perfect human disguise but defective Asimov's laws; and another Changeling
who wears the skin of one of his victims. Their identities are...


There was one long pause.

I'm sorry Captain, I'm afraid someone tampered with my laws. I will now


Hopefully, none of the crew heard that, and you know that it falls on you to find out who is who and take the necessary measures, again. You'll have to interrogate the crew without raising suspicion, and act swiftly with the help of your beloved laser gun before any antagonist can react.

But first, you assess the situation: the four antagonists the A.I. told you about will lie, it's a fact. And one of them is also responsible for hacking the A.I., and you'll have to know who. The Syndicate Nuclear Operative, or Nuke Op, had planted a bomb: that means he had to be alone in the past hour, which includes the time even before you met on the previous situation... You expect the Facehugged poor guy and the Changeling to act weird, the first out of fear to be euthanised to prevent the alien's growth, the other of not knowing its host's personality. No reason to act weird apart from that. Also, the Facehugged one would have been alone during the "act" in the past hour, or at least with another antagonist, or else an innocent person would have told already. And the Changeling could not have tampered with the A.I. even if impersonating someone who had the knowledge to do so. On the contrary, the Rogue Cyborg would be totally able to do that, whoever he is.

That's a good start, but now you ponder on the crew personnalities: the Medical Doctor can easily notice a Facehugged person, a Cyborg or a Changeling upon medical inspection. The Roboticist and the Chief Engineer are both able to hack the A.I., even with someone else in the room (they're really good at it). The Chaplain, you know him, is compelled to say the truth, even if an antagonist. However, as a Changeling he would not really be the Chaplain, and would still lie... The Security Officer, if an antagonist, would have killed you already... unless Facehugged. And as for the Clown, well... he stuck with you for the whole last two hours, severely annoying you with his stupid pranks but never acting weird.

Now is the time for questioning. Since you want to do it without raising suspicions, you can't ask hard questions. Still, you try your best:

-So, you were with the Roboticist all this time?
-Yes indeed.

Then you ask the Security Officer:

-Did you see anything unusual?
-Well, the Chaplain acted weird lately.

You thank him and go to the Medical Doctor:

-Did you make a medical inspection of some crewmembers in the past hour?
-Yes, of the Roboticist and Chief Engineer. Nothing unusual about those two.

-So, you were with the Chaplain all this time?
-No, he went out of the shuttle at least once.

You nod, quite perplexed, and go on with the Chief Engineer:

-Before we got together, what were you doing in the past hour?
-I was with the Security Officer the whole time. Also, I heard your conversation with the Medical Doctor, and he lied!

Something is definitly going on there, and you finish by interrogating the Clown:

-Any prank you played lately?
-Yeah, I slipped some drug in the Security Officer's coffee; he can only lie now!

Now, with all these informations, you have to guess:

• Who got Facehugged, so you can help him (if the Medical Officer is innocent) or shoot him in the chest.
• Who is the Changeling, so you can shoot him in the head.
• Who is the Rogue Cyborg, so you can shoot him in the head.
• Who is the Nuclear Operative, so you can force him to defuse the bomb. And then shoot him in the head.
• And finally, which one of them hacked the A.I., so you can ask him nicely how to hack it back to normal (before shooting him, obviously).

Good luck!

It is not necessary to read the previous puzzle, even if it continues on the same story (and is a cool puzzle). The current puzzle is a different one which can work as a pure standalone. For exemple, the fact that a crewmember was deemed innocent then means nothing now.

If you liked this puzzle, try the rest of the story!

• For calrification: if one of the liars makes two statements, are both of those always lies? e.g. Chief Engineer? – Mohirl Jun 28 '18 at 10:55
• @Mohirl yes, a liar lies on both statements. – Keelhaul Jun 28 '18 at 11:31
• Thanks. Another question though: if the Security Officer was a liar, would the Clown's drug make him flip to telling the truth, or would he just keep lying? – Mohirl Jun 28 '18 at 11:36
• @Mohirl As the Clown stated "he can only lie", even if he already was about to tell a lie. – Keelhaul Jun 28 '18 at 11:38
• Need a small clarification: by "which include the time even before you met on the previous situation" you mean Nuke Op can't be one of the 4 that were with you? Also: If an antagonist makes 2 statements, are they BOTH a lie? – George Menoutis Jun 28 '18 at 13:20

As currently constructed there is no solution.

The solution is below

Firstly I will prove that the doctor cannot be Normal by contradiction. Thus we assume the doctor is normal.

Given that the doctor is normal, the Robo end Engineer must either be normal, or syndicate members. Since we have at most 2 normal members, and the doc + robo/engineer is normal, we know that the Security Off is FaceHugged (or you'd be a goner).

Now we can figure out the clown

Given that we were with the clown the entire time, and he wasn't acting weird, he must be the cyborg (as the faceHug/changer make people weird, and a syndicate member needs alone time). This means by process of elimination the chaplain is Change. However this is a contradiction. We know that the Security is a liar bc he is a Face. Yet the opposite of his statement in that the Chap is acting weird implies the Chap is acting normally. Yet a Change does not act normally.

Nextly, I will prove why the clown also cannot be normal also by contradiction.

From above, we know the doctor is not normal and thus will be lying in his statement. As the Engineer states the doctor is lying, this is true making the Engineer normal. Once again given 2 normal people, we know the Security Officer must be a face (or you'd be a goner). However this is a contradiction, as we know the face must be alone for some time for the transformation, and the engineer stated they were together the entire time.

Finally,

From above, we know the clown must by the cyborg. (We stood with him and he hasn't acted weird, nor can he be a syndicate member as we are together, and we proved he isn't normal from above). From above, we know that the engineer must be normal as the doctor isn't. And to avoid the prior contradiction we must say that the Security Officer is the other normal person. This leaves us with the chaplain, the doctor and the robo guy for the 3 roles of Syndicate, FaceHug, and Changer.

The permutations are

Robo guy is a syndicate member. As a syndicate member he would need to be alone to plant the device. However, if his statement is truly a lie, he would have been with the Chaplain the entire time, thus a contradiction.

Next

Robo guy is a faceHugger. For the chaplain, we know that he must be acting weird (as the SO is normal and a truth teller) so he must be the changeling. A changeling Champlain is a liar, so he will be lying that he was with the robo guy the entire time. However this is a contradiction, because it would mean his statement would be true even though we have just said he is a faceHugger.

Lastly,

By process of elimination Robo guy is a changeling. This wrong because nobody could have tampered with the AI. The cyborg is with you, the Changeling Robo guy is incapable, and the Engineer is normal. After OPs edit, this provides that the clown as a cyborg could have tampered with the AI removing this contradiction. Figuring out the last 2 is easy. The Chaplain was with the robo guy the entire time and thus can't be the syndicate member. Thus the Chaplain is the FaceHugger, and the Doctor is the syndicate member.

In conclusion:

Security Officer and Engineer are normal. The chaplain is FaceHugged and can't be saved because the Doctor is the syndicate member. The Roboticist is the Changeling, and the Clown is the Rogue Cyborg. You must get the doctor to defuse the device, and ask the Clown to nicely unhack the device (or maybe ask the Engineer? He seems smart...)

• The error lies on what may be an imprecision of mine. I stated that both the Roboticist and Chief Engineer are "able to hack the A.I., even with someone else in the room", and this statement holds true for the Cyborg (even if not clearly stated). Also, it is implied the A.I. was hacked when you where alone in the cockpit just after receiving news from the A.I. (not clear either I confess). – Keelhaul Jun 28 '18 at 20:21
• @Keelhaul I still believe that my contradictions still hold, I never relied on that fact, could you double check my work/yours to see the inconsistency? – qwertylpc Jun 29 '18 at 18:29
• @keelhaul oh you are saying that a cyborg clown could have tampered with the AI – qwertylpc Jun 29 '18 at 18:37
• Indeed, and you got all right now ;) – Keelhaul Jun 30 '18 at 8:27
• Nice puzzle cheers – qwertylpc Jul 10 '18 at 14:40

Ok, I missed the fact that the cyborg cannot hack in secret. Now the solution is:

Engineer: innocent
security: innocent
doctor: nukeOp
roboticist: facehugger + hacker
chaplain: changeling
clown: cyborg

The fixed program:

% define all people and the secret roles
people([security,engineer,doctor,clown,roboticist,chaplain]).
roles([innocent,nukeOp,facehug,changeling,cyborg]).

% we store knowledge about a crew members identity in a term id(Role,Person,Hacker)
% variable ID refers to a single member, variable All to the entire crew
% initially, our only knowledge is that there are two innocents and one of every evil role
all([id(innocent,_,_)|More]) :- roles(Roles), findall(id(R,_,_),member(R,Roles),More).

% this filters duplicate solutions where the two innocents are swapped
noDups([id(_,A,_),id(_,B,_)|_]) :- ((var(A),var(B));(nonvar(A),var(B)); (nonvar(A),nonvar(B),compare(<, A, B))),!.

% predicates to check if a crew member is a person or role or hacker
isPerson(P) :- people(Pps), member(P,Pps).
isPerson(id(_,P,_), P) :- isPerson(P).
isRole(R) :- roles(Rs), member(R,Rs).
hasRole(id(R,_,_), R) :- isRole(R).
isHacker(id(_,_,1)).
% negation can be tricky in Prolog,
% to avoid bugs we use explicit negation predicates
isNotPerson(ID, P) :- isPerson(P), isPerson(ID,P2), P \= P2.
hasNotRole(ID, R) :- isRole(R), hasRole(ID, R2), R \= R2.
isNotHacker(id(_,_,0)).

% define evil, lying, and truth telling crew members
isEvil(ID) :- hasNotRole(ID, innocent).
isLiar(ID) :- isEvil(ID), (isNotPerson(ID, chaplain); hasRole(ID, changeling)), !.
isTruth(ID) :- isPerson(ID,_), hasRole(ID,_), \+ isLiar(ID).

% roboticist and engineer can hack if not innocent or changeling,
% cyborg can hack
canHackPublic(ID) :-
hasNotRole(ID, changeling), hasNotRole(ID,innocent),
(isPerson(ID, roboticist); isPerson(ID, engineer)).
canHack(ID) :-
canHackPublic(ID); hasRole(ID, cyborg).
hackingOnlyInPublic(ID) :-
canHackPublic(ID); isNotHacker(ID).

% nukeOp and facehugger needed time alone,
% but a liar would not report the facehugger
needsNoPrivacy(ID) :-
hasNotRole(ID,nukeOp), hasNotRole(ID,facehug), hackingOnlyInPublic(ID).
observedEachOther(ID1,ID2) :-
hackingOnlyInPublic(ID1), hackingOnlyInPublic(ID2),
(needsNoPrivacy(ID1); (isLiar(ID2), hasRole(ID1,facehug))),
(needsNoPrivacy(ID2); (isLiar(ID1), hasRole(ID2,facehug))).

% facehugger and changeling are weird
% facehugger, cyborg, changeling are detected by doctor
% again with explicit negation
isWeird(ID) :- hasRole(ID, facehug); hasRole(ID, changeling).
isNotWeird(ID) :- hasRole(ID,_), \+ isWeird(ID).
failInspect(ID) :- hasRole(ID, facehug); hasRole(ID, cyborg); hasRole(ID, changeling).
passInspect(ID) :- hasRole(ID,_), \+ failInspect(ID).

% we know security is innocent or facehugger,
% clown is not weird and had no privacy
factYours(All) :-
isPerson(Sec, security), member(Sec, All),
isPerson(Clwn, clown), member(Clwn, All),
(hasRole(Sec, innocent); hasRole(Sec, facehug)),
isNotWeird(Clwn), needsNoPrivacy(Clwn).

% chaplain claimed he and roboticist observed each other the entire time
% if lying we can't conclude anything
factChaplain(All) :-
isPerson(Chap, chaplain), member(Chap, All),
isPerson(Robt, roboticist), member(Robt, All),
(isTruth(Chap) ->
observedEachOther(Chap,Robt) ;
true).

% security can only tell truth if clown was lying,
% claimed chaplain is weird, when it's a lie he's not weird
factSecurity(All) :-
isPerson(Sec, security), member(Sec, All),
isPerson(Chap, chaplain), member(Chap, All),
isPerson(Clwn, clown), member(Clwn, All),
((isTruth(Sec),isLiar(Clwn)) ->
isWeird(Chap);
isNotWeird(Chap)).

% docter claimed roboticist and engineer passed inspection,
% if lie at least one failed
factDoctor(All) :-
isPerson(Doc, doctor), member(Doc, All),
isPerson(Robt, roboticist), member(Robt, All),
isPerson(Eng, engineer), member(Eng, All),
(isTruth(Doc) ->
(passInspect(Robt), passInspect(Eng)) ;
(failInspect(Robt); failInspect(Eng))).

% roboticist claimed chaplain left, this tells us nothing
% but if lie then both observed each other
factRoboticist(All) :-
isPerson(Robt, roboticist), member(Robt, All),
isPerson(Chap, chaplain), member(Chap, All),
(isTruth(Robt) ->
true;
observedEachOther(Robt, Chap)).

% engineer claimed to observe security and that doc is lying,
% if lie then doc told truth
factEngineer(All) :-
isPerson(Eng, engineer), member(Eng, All),
isPerson(Sec, security), member(Sec, All),
isPerson(Doc, doctor), member(Doc, All),
(isTruth(Eng) ->
observedEachOther(Eng, Sec), isLiar(Doc) ;
isTruth(Doc)).

% to solve, initialize the crew list, apply all facts,
% and ensure there is a hacker
solve(All) :-
all(All),
factYours(All), factChaplain(All),
factSecurity(All), factDoctor(All),
factRoboticist(All), factEngineer(All),
noDups(All),
isHacker(Hacker), member(Hacker, All),
canHack(Hacker).


Calling solve(All). returns

All = [id(innocent, engineer, 0), id(innocent, security, 0), id(nukeOp, doctor, _1360), id(facehug, roboticist, 1), id(changeling, chaplain, 0), id(cyborg, clown, 0)]

• heavy-duty stuff! We certainly need the explain later part :D – George Menoutis Jun 29 '18 at 11:21
• So I guess, in order to explain the process, you will just see your program's run log? Could you please paste it into the answer so I can learn some prolog from it? – George Menoutis Jun 29 '18 at 11:27
• OK guys, I think we got the Cyborg... Great work! – Keelhaul Jun 30 '18 at 8:21

The Security Officer (SO) can't be an enemy unless they're Facehugged, which would require them being alone. But they weren't, if the Engineer is telling the truth. Therefore if the SO is an enemy the Engineer must be lying. That means the Medical Doctor (MD) is telling the truth. If the MD didn't recognise an enemy, the Engineer must be the Nuke Op. The Roboticist must be innocent. So everyone else is guilty, including the Chaplain. But the Chaplain would still be telling the truth, in conflict with the innocent Roboticist, unless he's the Changeling. But he can't be, since the Security Officer lied when he said he acted weird. So the Engineer can't be lying, so both he and the SO are innocent.

So all the others are enemies.

The only role the Clown could be is Cyborg, since being with you and not acting weird rules out the other three. The Chaplain is acting weird but telling the truth. So must be the Facehugged. They weren't alone, but that's OK because the Roboticist is an enemy. That leaves the MD and the Roboticist as Nuke Op and Changeling, but only the MD was alone, so they're the Nuke Op. The Roboticist is the changeling.

So in summary, shoot the:

Chaplain in the chest as the Facehugged, Roboticist in the head as the changeling, Clown in the head as the Rogue Cyborg, and the Medical Doctor in the head after defusing his Nuke Op bomb.

But first, get the

Roboticist, who was able to corrupt the AI even while accompanied Medical Doctor, since he was the only baddie alone (and the changeling Roboticist couldn't do it)

to fix the AI

• Good start, but I saw one mistake somewhere :) – Keelhaul Jun 28 '18 at 11:34
• Ah! I've spotted it. Grrr!!!! – Mohirl Jun 28 '18 at 11:54
• In fact, there is at least another mistake, but the first one threw your reasoning on the wrong path already so... try again^^ – Keelhaul Jun 28 '18 at 11:54
• I had at least two but couldn't work out where the original error was, so I threw it all out and started again from another angle. Think I have it this time! – Mohirl Jun 28 '18 at 14:24
• It's stated that "The Roboticist and the Chief Engineer are both able to hack the A.I." and "the Changeling could not have tampered with the A.I. even if impersonating someone who had the knowledge to do so. On the contrary, the Rogue Cyborg would be totally able to do that, whoever he is.", which kind of implies the others cannot ;) – Keelhaul Jun 29 '18 at 13:30