Results 1 to 2 of 2
Thread: Mastermind game problem
- 04-16-2011, 03:02 PM #1Member
- Join Date
- Apr 2011
- Rep Power
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.
- By Alexander_003 in forum AWT / SwingReplies: 4Last Post: 03-16-2011, 06:08 PM
- By Ebayer in forum New To JavaReplies: 2Last Post: 03-14-2011, 07:23 PM
- By MishkaRX in forum New To JavaReplies: 11Last Post: 12-14-2010, 02:39 PM
- By papinhio in forum New To JavaReplies: 4Last Post: 07-09-2010, 03:51 PM
- By javabeginer in forum New To JavaReplies: 10Last Post: 04-14-2009, 02:11 AM