• There are only four letters: A, B, C, and D.

• A letter cannot be placed into the entry line twice.

• Once the entry line is full, the computer will tell us the number of letters in the right location.

• We will explore three-letter terminals, but there are two-letter and four-letter terminals in the game.

In the case of three-letter terminals, since I cannot repeat any letters, I know that there are only 24 possible solutions:

ABC | ABD | ACB | ACD | ADB | ADC |

BAC | BAD | BCA | BCD | BDA | BDC |

CAB | CAD | CBA | CBD | CDA | CDB |

DAB | DAC | DBA | DBC | DCA | DCB |

Now, there is, of course, only a 1/24 chance of ABC being correct. More than likely, the correct answer is one of the other 23. Fortunately, the remote modem will indicate how many letters are in the correct position

If ABC is not correct, the number of letters (as returned by the terminal) can be either '0 correct', '1 correct', or '2 correct'. The number correct will help me eliminate certain possibilities, as indicated below.

2 correct, possible answers: (3/23 entries) | ABD | ADC | DBC | ||||||||

1 correct, possible answers: (9/23 entries) | ACB | ACD | ADB | BAC | BDC | CBA | CBD | DAC | DBA | ||

0 correct, possible answers: (11/23 entries) | BAD | BCA | BCD | BDA | CAB | CAD | CDA | CDB | DAB | DCA | DCB |

If I get a result of 1, then I can pick from either of the 9 entries with a 1/9 chance of it being correct. If I pick the wrong combination, the number correct will depend on the result that I pick: Selecting DBA and getting '2 correct' (keep in mind that we know that the correct answer is one of the blue entries because we've already tried ABC) means that the correct answer is CBA (you can check the other blue entries and verify that there is only one with two entries that match DBA). Selecting BAC and getting '2 correct' means that the correct answer is either BDC or DAC.

Furthermore, selecting BAC will never produce a result of '1 correct', but selecting DBA has two possibilites for '1 correct'. The nine possibilities fall into one of these two categories: ACB, BAC, and CBA (two '2 correct' entries with no '1 correct entries'); ACD, ADB, BDC, CBD, DAC, and DBA (one '2 correct' entry and two '1 correct' entries).

Which one am I interested in? Since I want to solve the puzzle as quickly as possible, I am interested in the one with the most balanced sets of entries (the latter list of six). The distribution of resultant entries are equivalent, so I can pick either one. ACD is the first in the list, so I will pick this one.

The top result, '2 correct', after ACD (if ACD is not the correct answer) is ACB. If '1 correct' then, the result is either ADB or CBD. If I had to pick one and it is wrong, then I simply pick the other one (for clarity's sake, the result will be '0 correct' if I pick the wrong one). The decision branches further with the five remaining entries:

0 correct, possible answers: (5 entries) | BAC | BDC | CBA | DAC | DBA |

Now, to work on the initial '0 correct' entries from ABC.

0 correct, possible answers: (11/23 entries) | BAD | BCA | BCD | BDA | CAB | CAD | CDA | CDB | DAB | DCA | DCB |

2 correct, possible answers: (3/10 entries) | BCD | BDA | DCA | |

1 correct, possible answers: (3/10 entries) | BAD | CDA | DCB | |

0 correct, possible answers: (4/10 entries) | CAB | CAD | CDB | DAB |

Of course, the possibilities for '2 correct' are the same as that of the initial guess ABC (with all options being related to each other by '1 correct', I just pick until I get the correct answer), so I've already filled them into the table. The entries for '1 correct', however, are also related to each other only by '0 correct', so I will also have to pick them similar to how I pick from the results of '2 correct' entries. The only part that requires effort is the four '0 correct' entries: CAB, CAD, CDB, and DAB. A cursory look at the four entry possibilities shows that there are no possible '0 correct' entries at this point; each entry has at least one letter in common with the other three. CAB produces '2 correct' entries with all of the other entries, so it would not speed up the decision making process greatly. The other three entries match each other as a '1 correct' entry, so either one will be a suitable starting point (and I will start with CAD). Note that a '2 correct' entry indicates that CAB is the right answer; otherwise, I will then try either CDB or DAB until I get the right answer. This will allow me to fill out the flow chart.

All of the possible combinations of four letters in three slots appear somewhere in this flowchart, and from each, you can trace how I would have figured out this as the correct answer. For instance, if the correct answer is BAD, starting with ABC would give me the result of '0 correct'. I would then move to BCA and get '1 correct'; I would try BAD, CDA, or DCB until I get the correct answer.

I previously had a less optimized solution to this puzzle with ACB in place of ACD; this was a worse solution because ACB produces no '1 correct' entries and requires me to guess if I get '2 correct', but moreso because there were six possibilities if ACB returns '0 correct' and here there are only five. This gives me an expected number of guesses for the solution at 3.5 moves (it was 3.58).

Update: August 30, 2014

On a whim, while waiting for a class to start, I took a closer look at the branch of '0 correct' at ABC and decided that there may be, by some longshot, a way to get the right answer with only four layers, so I decided to try changing the result from BCA to CAD (if you recall, CAD has two '2 correct' and four of both '1 correct' and '0 correct') in hopes that I can get one entry on each sub-entry's possible outcomes. The results are as follows:

2 correct, possible answers: (2/10 entries) | BAD | CAB | ||

1 correct, possible answers: (4/10 entries) | BCD | CDA | CDB | DAB |

0 correct, possible answers: (4/10 entries) | BCA | BDA | DCA | DCB |

There's no optimization possible for any '2 correct' entries, as it has been for the entirety of this flowchart, but I need to pick an entry in both '1 correct' and '0 correct' that has one possible outcome for each result. I drew the results for each entry and found that the following results work well: CDB for '1 correct' and BDA for '0 correct'. The chart now looks like this:

This new chart now gives an expected number of guesses at 3.375, which means that this chart is a great improvement over the previous chart (as you can tell, because there is now only one path left that requires five guesses). I don't see any method for improving the '1 correct' from ABC path, because all of the results produce 5-7 entries for '0 correct', which is *just* large enough to prevent me from having any possibility of making the clump of four like I just did.