|
-
March 5th, 2010, 08:57 AM
#4
Re: Mastermind java game (non object-oriented version)
The isColourInCode() method doesn't need to set a variable to true, it can just return true the first time the if statement is true.
The way to handle your problem is to make a copy of the secret code, find all matching pegs first and remove them from the copy (or set them to a special value denoting matched). Then look for incorrect values by checking against the copy.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|