Does the girl know computing addition to math? Probably.
"Here is an array of three character strings, indexed from [1]
:
s[] = { "Yes", "No", "I don't know" }
what is the value of s[x]
where x
is the number you are thinking of?"
Basically, the space of three possible answers can be used as symbols to encode the information directly.
Justification, in the light of comments:
The other answers differ in that they employ an arithmetic and logical coding trick: arithmetic is applied and then logic to produce an answer, whose truth value or in determinacy is then rendered to English "Yes", "No" or "I don't know".
It is just as valid and "mathematical" to simply obtain these symbols directly without using arithmetic coding.
Furthermore, it can still be regarded as arithmetic coding, because the answer strings are made of bits, and can therefore be coded as numbers: for instance, the bit patterns of the ASCII characters can be catenated together and treated as large integers. s
is then effectively just a numeric table lookup which maps the indices 1 through 3 to integer symbols which denote text when broken into 8 bit chunks and mapped to ASCII characters.
A lookup table, though arbitrarily chosen, is a mathematical object: a function.
Furthermore, the displacement calculation to do the array indexing is arithmetic; we are exploiting the fact that the information we are retrieving is numeric and can be used to index into a table. Otherwise we would have to specify an associative set relation instead of a function from the integer domain. ("Here is a mapping of your possible state values to the symbols I'd like you to use to send me the value.")
This answer reveals that the question is basically uninteresting. An entity holds some information that can be in one of three states, and there is to be a three-symbol protocol for querying that information. It boils down to, give me the symbol which corresponds to your state, according to this state->symbol mapping function. I would therefore argue that the convoluted arithmetic coding is the hack answer not this straightforward coding method. In computing, we sometimes resort to arithmetic encoding hacks when we have to use a language that isn't powerful enough to do some task directly, or simply when the resources (time, space) aren't there for the cleaner solution.
I am thinking of a number greater than 1 and less than 3. Is my number greater than yours?
-- That would work. $\endgroup$I am thinking of a number that is either 1 or 2. Is my number greater than or equal to yours?
$\endgroup$I'm also thinking of a number. It's either 1.5 or 2.5. is my number bigger than yours? :)
$\endgroup$