# Getting parts of an object in a decision phrase

This seems like it should be simple but I can’t figure it out. I want to make a decision regarding a person based on the state of something that is part of them, but so far I’ve only been able to do it in a very roundabout way:

[code]A brain is a kind of thing. A brain can be active or inactive. A brain is usually inactive.
A brain is part of every person.

To decide whether (X - a person) can solve the puzzle:
If entry 1 in the list of brains incorporated by X is active:
yes;
no.[/code]

I’d like to be able to say X’s brain or the brain of X instead of using the list, but the compiler doesn’t know what to do with these. It will accept If Joe’s brain is active (assuming I specify that Joe exists), so it’s not a syntax issue. I thought it might be that there’s no guarantee that something in the course of play hasn’t removed X’s brain, but there’s no such guarantee for Joe, either.

What gives?

You can do it slightly more concisely, without a list:

``````To decide whether (X - a person) can solve the puzzle:
if an active brain is part of X:
yes;``````

It’s still awkward though. There’s no direct way to say “the brain of person P”.

I should mention the indirect way to do it:

``````To activate brain for (X - a person):
if a brain (called B) is part of X:
now B is active;``````

The “if” is redundant, because every person should have a brain, but it gets the job done.

Odd, but it works. Thanks!

Any ideas on why this limitation exists?

It exists because there’s no guarantee that “the brain of X” is unique. You specified that “a brain is part of every person.” That’s all well and good, and mostly guarantees that every person will have at least one brain. However, nothing stops you from then saying “Seven brains are part of every hydra.” and even “23 brains are part of the Lernaean Hydra.”, because exceptions to exceptions to general rules are the heart and soul of IF, or at least of Inform 7. If that’s not enough, you could always have someone’s brain eaten by zombies during play, at which point a hypothetical “the brain of X” phrase wouldn’t be able to produce anything. Inform doesn’t want to be in this situation, so it forces you to specify exactly how you’re going to find a particular brain that you feel is sufficiently associated with X. The usual circumlocution people use at this point is “a random active brain which is part of X”, and testing whether they got nothing; but in this case you only need to know if one exists, so zarf’s code is plenty.

Your test with “Joe’s brain” was actually misleading, which is probably why you are confused. This doesn’t mean “the brain that is part of Joe”. It actually means “the object called Joe’s brain”, which is the default name of the brain automatically generated by the combination of the sentences “Joe is a person.” and “A brain is part of every person.” If Joe’s brain gets eaten by zombies (and moved off-stage), it’s still “Joe’s brain”, but it isn’t “a brain which is part of Joe” anymore, because you ripped it out.

This example got really violent. I blame mass media.