Results 1 to 5 of 5
  1. #1
    papinhio is offline Member
    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    Default 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 test-cases and for this reason the program must be efficient...
    Any help?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by papinhio View Post
    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!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Also moving to the new to Java forum for closer topic alignment.

  4. #4
    papinhio is offline Member
    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    Default

    If anyone can gives me any efficient algorithm..
    That's the first step i thinkk!

  5. #5
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default

    Last edited by Fubarable; 07-09-2010 at 10:21 PM. Reason: removed profanity

Similar Threads

  1. how to make mastermind game
    By javabeginer in forum New To Java
    Replies: 10
    Last Post: 04-14-2009, 02:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •