MasterMindisagamefortwoplayers. Oneofthem,Designer,selectsasecretcode. Theother,Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the players agree upon the length N that a code must have and upon the colors that may occur in a code. Inorderto breakthecode, Breakermakesanumber ofguesses, eachguessitself beinga code. After each guess Designer gives a hint, stating to what extent the guess matches his secret code. In this problem you will be given a secret code s1 …sn and a guess g1 …gn, and are to determine the hint. A hint consists of a pair of numbers determined as follows. A match is a pair (i,j), 1 ≤ i ≤ n and 1 ≤ j ≤ n, such that si = gj. Match (i,j) is called strongwhen i = j, and is called weak otherwise. Two matches (i,j) and (p,q) are called independent when i = p if and only if j = q. A set of matches is called independent when all of its members are pairwise independent. Designer chooses an independent set
Master-Mind Hints(思维)
最新推荐文章于 2020-02-11 00:42:12 发布
本文介绍MasterMind游戏的玩法,包括秘密代码、玩家猜测和设计师给出的提示规则。通过输入输出示例解释游戏流程,并提供解题思路与代码实现方法,涉及匹配类型、独立匹配集的概念。
摘要由CSDN通过智能技术生成