Optimal algorithms for 2 × n mastermind games - A graph-partition approach

Shan Tai Chen*, Shun Shii Lin

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

14 Citations (Scopus)


This paper presents new and systematic methodologies for analyzing deductive games and obtaining optimal algorithms for 2 × n Mastermind games, where n ≥ 2. We have developed a graphic model to represent the game-guessing process. With this novel approach, we find some symmetric and recursive structures in the process. This not only reduces the size of the search space but also helps us to derive the optimum strategies more efficiently. By using this technique, we develop optimal strategies for 2 × n Mastermind games in the expected and worst cases and are able to derive the following new results: (i) ⌊n/2⇔ + 2 guesses are necessary and sufficient for 2 × n Mastermind games in the worst case. (ii) The minimum number of guesses required for 2 × n Mastermind games in the expected case is (8n3 + 51n2 - 74n + 48)/24n2 if n is even and (8n3 + 51n2 - 80n + 69)/24n2 if n is odd. The optimization of this problem bears a resemblance to other computational problems such as circuit testing, differential cryptanalysis, on-line models with equivalent queries and additive search problems. Any conclusion of this kind of deductive game may be applied, although probably not directly, to any of these problems as well as to any other combinatorial optimization problem.

Original languageEnglish
Pages (from-to)602-611
Number of pages10
JournalComputer Journal
Issue number5
Publication statusPublished - 2004

ASJC Scopus subject areas

  • General Computer Science


Dive into the research topics of 'Optimal algorithms for 2 × n mastermind games - A graph-partition approach'. Together they form a unique fingerprint.

Cite this