Results 1 to 5 of 5
Thread: MasterMind Problem!!
 07092010, 01:10 AM #1Member
 Join Date
 Jul 2010
 Posts
 2
 Rep Power
 0
MasterMind Problem!!
Hi to all,
I must to make a program in java.
The problem is this:
We have 2 players: player A and player B.
Player A think a numbers, and says to player B the crowd of digit of the number that he thought.
Player B says to player A numbers which have those digits that player A said to him.
Then, player A says to player B two numbers the first one says how many digits in the number that player B told is matching with the number that player A thought, and the other one says how many digits that player B told there are in number that player A thought, but it's not in the correct position.
I must to write a program which takes from input the crowd of digit of the number that player A thought, phases of the game and returns the smaller number that satisfies the conditions.
For example with this input
4 4
3157 1 2
1350 2 1
6120 0 2
2381 3 0
must returns
2351
the first 4 is the crowd of digit that A thought.
the second 4 is the crowd of phases....
Another example 7 0 output: 0000000
If there are no solution the output of program must be "1"
The program must be in Java...
There are strictly testcases and for this reason the program must be efficient...
Any help?

Break the big problem down into small sub problems and start working on creating classes, fields and methods that solve the small problems one at a time. Do not move on to the next step until the current step has been solved and the current code compiles OK. Please have a look at the links in my signature, especially the last one "so you need to write a program..."
If you need more specific help, and get stuck at a particular step, please feel free to ask a more specific question and show your code as best you can (also see my signature link on code tags).
Much luck!

Also moving to the new to Java forum for closer topic alignment.
 07092010, 10:00 AM #4Member
 Join Date
 Jul 2010
 Posts
 2
 Rep Power
 0
If anyone can gives me any efficient algorithm..
That's the first step i thinkk!
 07092010, 04:51 PM #5Senior Member
 Join Date
 Sep 2008
 Location
 Stockholm, Sweden
 Posts
 119
 Rep Power
 0
Similar Threads

how to make mastermind game
By javabeginer in forum New To JavaReplies: 10Last Post: 04142009, 03:11 AM
Bookmarks