Tutorial :Bulls & Cows C# Implementation (Mastermind Variation)



Question:

Bulls & Cows is a game for two players in which each one has a secret number with 4 non-repeating digits, and each one tries to guess the other number.

For instance, let´s say my secret number is 1576.

If my opponent says the number 1234, i would answer: 1F, because the digit 1 is in my secret number and in the same position. If my opponent says the number 7890, i would answer: 1P, because the digit 7 is in my secret number and in different position. ETC. Here it is explained.

Well, as a hobby, I wish to implement a computer player that tryes to guess my number, but I don't know where to start,

  • any ideas?
  • Is there something already done on this game?
  • Is out there any C# Implementation?


Solution:1

This is a variant of the game Mastermind. Quite a lot of work has been done on algorithms for guessing solutions. Beyond those shown at the wikipedia link, some googling using "mastermind" as the keyword will probably turn up a lot. (I'm assuming you haven't found much so far because you didn't know that name).


Solution:2

It sounds like a variation on the game 'Mastermind' - there are a few resources here and here (.doc), as well as on the Wikipedia page.

Have fun!


Solution:3

Sounds like a MasterMind variant.


Solution:4

You're playing a variation of the board game "Mastermind". See the algorithm section of the wikipedia article:

http://en.wikipedia.org/wiki/Mastermind_(board_game)


Solution:5

This is a linux flavor of the game, I'm pretty sure you can get source for it and port it to C#

http://sourceforge.net/project/showfiles.php?group_id=182681&package_id=211908

have fun..


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »