Results 1 to 2 of 2
  1. #1
    TheQuad is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default Mastermind game problem

    Hi I'm having a problem and cant figure it out
    Last edited by TheQuad; 04-25-2011 at 01:17 PM. Reason: Code tags added

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

    Default

    Think through the logic on paper first -- how would you check for a win if you were doing this on paper and without a computer since the solution would fall out of this.

    A couple of considerations:
    • Consider just checking for correct number/position first, meaning check only if position i == guess i before checking any positions for correct number but incorrect position.
    • Consider setting a match to some placeholder value. For instance if any numbers match, consider changing them to -1 (but then don't allow matching -1's to be valid) so you know not to use that guess and that answer's number again.


    Please note that I added code tags to your post to allow your pasted code to retain its formatting and be readable. To do this yourself, please check the link on how to use code tags immediately below.

Similar Threads

  1. problem mastermind
    By Alexander_003 in forum AWT / Swing
    Replies: 4
    Last Post: 03-16-2011, 06:08 PM
  2. MasterMind Assignement , Use of String Class
    By Ebayer in forum New To Java
    Replies: 2
    Last Post: 03-14-2011, 07:23 PM
  3. Mastermind!
    By MishkaRX in forum New To Java
    Replies: 11
    Last Post: 12-14-2010, 02:39 PM
  4. MasterMind Problem!!
    By papinhio in forum New To Java
    Replies: 4
    Last Post: 07-09-2010, 04:51 PM
  5. how to make mastermind game
    By javabeginer in forum New To Java
    Replies: 10
    Last Post: 04-14-2009, 03:11 AM

Tags for this Thread

Posting Permissions

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