|
||
Title: Mastermind Puzzles (6 Colours) Post by daemonturk on Feb 21st, 2009, 4:12am You may need to familiarize yourself with the game of Mastermind (Logic/Deduction type boardgame). http://en.wikipedia.org/wiki/Mastermind_(board_game) I'm not sure if this belongs in pure math, but I need help. MARKERS: W = Correct colour, Wrong Position B = Correct colour, Correct Position (Becareful with the rules about corresponding markers with duplicate pegs) Colours: 6 1. If the first guess is BBCC, and the feedback is WWW, how many remaining possible combinations are there? 2. If the first guess is BBCG, and the feedback is WWBB, how many remaining possible combinations are there? 3. If the first guess is BCGR, and the feedback is WWWB, how many remaining possible combinations are there? 4. First Guess: BCGR, Feedback: WWBB, Remaining Possible Combinations: ? Please help me find the answers to all these questions, and if possible, explain how you solved them. To help you guys further, I will put an example question and answer. Example Question and Solution First Guess: BBBC, Feedback: B Solution: If we assume Black is the one in the correct position, the other three colours MUST be wrong entirely because there was no 'W's in the feedback. Hence, the other 3 slots can be any of 4 colours (because they can't be Black or Cyan). So we end up with (3 x 4^3) because there were 3 Blacks. If we assume Cyan is correct in position, the first 3 slots are entirely wrong, and hence could be any of the 5 colours (for black is wrong). Hence, 5^3. The total possible combinations remaining out of the total 1296, is (3 x 4^3) + 5^3 = 317. Thanks a lot guys! |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by tohuvabohu on Feb 21st, 2009, 1:03pm 1. If the first guess is BBCC, and the feedback is WWW, how many remaining possible combinations are there? Possibilities: swap bb with cc, then replace any peg with one of the 4 other colors. ?CBB 4 C?BB 4 CC?B 4 CCB? 4 2. If the first guess is BBCG, and the feedback is WWBB, how many remaining possible combinations are there? Possibilities: every possible swap of two pegs except swapping the two B’s BBGC CBBG GBCB BCBG BGCB 3. If the first guess is BCGR, and the feedback is WWWB, how many remaining possible combinations are there? Possibilities: two rotations possible for each of 4 choices of the one stationary peg BGRC BRCG GCRB RCBG CRGB RBGC CGBR GBCR 4. First Guess: BCGR, Feedback: WWBB, Remaining Possible Combinations: ? Possibilities: every possible swap of two pegs CBGR GCBR RCGB BGCR BRGC BCRG |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by daemonturk on Feb 21st, 2009, 6:43pm Very nice. How about: First Guess: BBCG, Feedback: WWW (Challenging) |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by towr on Feb 22nd, 2009, 8:25am It's fairly easy to write a small program to give you the result. And since 64 isn't that much, you don't even need to take a smart approach to it. Just running through all possible sequences and checking which match works. Code:
It gives 44 for the last one. |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by daemonturk on Feb 22nd, 2009, 8:27am 44 is correct, but I'm not familiar with this language, is it C#? It would be good if I had a logical solution too :-/ |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by towr on Feb 22nd, 2009, 8:43am on 02/22/09 at 08:27:32, daemonturk wrote:
I'll have to think a bit more about a logical solution. |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by tohuvabohu on Feb 22nd, 2009, 12:09pm If there are two B’s, and a fourth color then it’s either C?BB 3 ?CBB 3 G?BB 3 ?GBB 3 If there are two B’s and G or C is repeated then it’s CCBB GGBB If there is one B and a fourth color, then it’s CGB? 3 CG?B 3 C?GB 3 ?CGB 3 GCB? 3 GC?B 3 G?BC 3 ?GBC 3 If there is one B, and C or G is repeated, then it’s CGBC GCBC GGBC CGGB CCGB GCGB |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by daemonturk on Feb 22nd, 2009, 11:14pm Thanks, tohuvabohu ;D @towr: Your code is impressive, but I'm not familiar with javascript to appreciate it =( |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by towr on Feb 23rd, 2009, 12:25am on 02/22/09 at 23:14:12, daemonturk wrote:
Most pieces would work the same in java, C, C++, and similar languages though. |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by Aryabhatta on Mar 14th, 2009, 11:34am Can we move this out of putnam section? |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by daemonturk on Mar 14th, 2009, 9:03pm It belongs here, its a conditional probability game. |
||
Title: Re: Mastermind Puzzles (6 Colours) Post by Eigenray on Mar 15th, 2009, 6:09am Well, it was in Putnam, until somebody moved it. Maybe I should have said something, but I thought it would be obvious. |
||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |