# Optimal Analyses for 3  n AB Games in the Worst Case Li-Te Huang and Shun-Shii Lin Dept. of Computer Science & Information Engineering, National Taiwan.

## Presentation on theme: "Optimal Analyses for 3  n AB Games in the Worst Case Li-Te Huang and Shun-Shii Lin Dept. of Computer Science & Information Engineering, National Taiwan."— Presentation transcript:

Optimal Analyses for 3  n AB Games in the Worst Case Li-Te Huang and Shun-Shii Lin Dept. of Computer Science & Information Engineering, National Taiwan Normal University, Taipei, Taiwan, R.O.C

2 Outline Introduction The Key Idea of the Worst-Case Gaming Process Terminologies Analyses of the Worst-Case Strategy Conclusions

3 Introduction The deductive game is a kind of logic games. A codemaker and a codebreaker are involved. –Codemaker: think of a secret code in mind –Codebreaker: identify the secret code by guessing constantly. –The mission of the codebreaker: obtain the code minimize the number of guesses required –There are two families of deductive games according to one characteristic. Mastermind: repeated symbols are allowed in a code. AB game: all symbols within a code are distinct.

4 Introduction (cont.) 3  n AB game –A secret code: 3 digits and every digit has n possibilities (symbols) –For example, the set of these n symbols: S = {d 0,d 1,…,d n-1 } –The codemaker: c = d i d j d k, the codebreaker: g = d l d m d p

5 Introduction (cont.) The codemaker will give a response “xAyB” or called [x, y] as well. –x means the number of symbols which appear in both c and g and meanwhile, each symbol occupies the same position in both c and g. –y represents the number of symbols which occur in both c and g but the positions of these symbols in c and g do not match. –9 possible responses: [3, 0], [2, 0], [1, 2], [1, 1], [1, 0], [0, 3], [0, 2], [0, 1], and [0, 0]

6 The Key Idea of the Worst-Case Gaming Process d 0 d 1 d 2 1st guess d 3 d 4 d 5 2nd guess d 6 d 7 d 8 3rd guess Apply a branch-and-bound search algorithm to find an optimal strategy for smaller n. 1st response (the worst-case response) 0A0B 2nd response (the worst-case response) 0A0B 3rd response (the worst-case response) 0A0B When h  11 For a 3  20 AB game, the set of all symbols: S = {d 0, d 1, …, d 19 } 3  n AB game, n = 20 (best guess) Reduce to 3  h AB game, h = 17 Reduce to 3  h AB game, h = 14 Reduce to 3  h AB game, h = 11

7 An Illustrative Example for the Terminologies Ex: a 3  5 AB game –S = {0, 1, 2, 3, 4} –Codebreaker: g = 012 –Codemaker responses [2, 0], C [2,0] = {013, 014, 032, 042, 312, 412} –Another responses [1, 0], C [1,0] = {043, 034, 432, 342, 314, 413}

8 We say that C [1,0] dominates C [2,0] if we can find a mapping r – r can map from each code in C [2,0] to another one in C [1,0] –The mapped codes in C [1,0] preserve the structures of those in C [2,0]. Identifying a code in C [1,0] requires the same or larger number of guesses than that in C [2,0] if C [1,0] dominates C [2,0]. We call that C [1,0] is as hard as or harder than C [2,0]. C [2,0]  C [1,0]

9 Analyses of the Worst-Case Strategy Suppose that in a 3  n AB game, the set of symbols: S = { d 0,d 1,…,d n-1 } Assume that the first guess is d 0 d 1 d 2.

10 The Codemaker’s First Response The codemaker tries to maximize the number of guesses required for the codebreaker Among the 9 possible responses, the codemaker answers [0, 0], where n  11, at the first response. –We can prove that C [0,0] dominates the other 8 states by using the techniques of the structural reduction. –In other words, C [0,0] is the hardest state. C [0,0] C [0,1] C [1,0] C [0,2] C [1,1] C [2,0] C [0,3] C [1,2] C [3,0]

11 The Following Responses Now, our problem therefore reduces to a 3  h AB game, where h = n-3. In fact, for a 3  h AB game, where 11 ≤ h ≤ n –The codemaker always offers [0, 0] as the worst-case responses with the use of the same techniques to prove it.

12 Analyses of the Optimal Guesses for the Codebreaker in the following guesses The codebreaker has to determine the best guess when he encounters a 3  (n-3) AB game in the second turn. Define two subsets of S –A = {d 0, d 1, d 2 } –B = {d 3, d 4, d 5,… d n-1 }

13 Four Types of Guesses for the Codebreaker All possible guesses can be classified into four types –Suppose that d 0, d 1, d 2 ∈ A and d i, d j, d k ∈ B. Type 1: d 0 d 1 d 2 –If the codebreaker makes this kind of guesses, all the codes, which satisfy the first guess and first response, are then classified into the same substate trivially. –This will lead to non-optimal strategies.

14 Four Types of Guesses for the Codebreaker (cont.) Type 2: d 0 d 1 d i –With the use of the techniques of structural reductions, we can prove that C [0,0] dominates C [0,1] and C [1,0] –C [0,0] is produced when the codebreaker makes the second guess, d 0 d 1 d i, and the codemaker responses [0,0]. The meanings of the other two states are similar. C [0,0] C [0,1] C [1,0] When h  5

15 Four Types of Guesses for the Codebreaker (cont.) Type 3: d 0 d i d j –With taking advantage of the same techniques, we can also prove that C [0,0] dominates the other states. C [0,0] C [0,1] C [1,0] C [0,2] C [1,1] C [2,0] When h  8

16 Four Types of Guesses for the Codebreaker (cont.) Type 4: d i d j d k –We are able to prove that C [0,0] dominates other states as well. C [0,0] C [0,1] C [1,0] C [0,2] C [1,1] C [2,0] C [0,3] C [1,2] C [3,0] When h  11

17 Summaries of the Optimal Guesses for the Codebreaker Redefine C (2), C (3), and C (4) to denote the hardest states caused by guessing d 0 d 1 d i, d 0 d i d j, d i d j d k respectively. So, C (4) is the easiest state among the three state and then d i d j d k is the optimal guess for the codebreaker. C (2) C (3) C (4) Guess d 0 d 1 d i Guess d 0 d i d j Guess d i d j d k

18 Conclusions The codemaker and the codebreaker will have the above behavior until h  11. For a 3  n AB game, the minimum number of guesses for the codebreaker in the worst case can be derived as A natural generalization: m  n AB games, where m ≥ 4. This problem remains open.