Mastermind: Difference between revisions
Content added Content deleted
(New post.) |
m (Minor code alteration.) |
||
Line 1,520: | Line 1,520: | ||
=={{header|Java}}== |
=={{header|Java}}== |
||
<syntaxhighlight lang="java"> |
<syntaxhighlight lang="java"> |
||
import java.util.ArrayList; |
import java.util.ArrayList; |
||
import java.util.Collections; |
import java.util.Collections; |
||
Line 1,577: | Line 1,576: | ||
while ( guessCount > 0 && ! playerWin ) { |
while ( guessCount > 0 && ! playerWin ) { |
||
showBoard(); |
showBoard(); |
||
if ( |
if ( checkUserInput(obtainUserGuess()) ) { |
||
playerWin = true; |
playerWin = true; |
||
reader.close(); |
reader.close(); |
||
Line 1,628: | Line 1,627: | ||
} |
} |
||
private boolean |
private boolean checkUserInput(String aUserInput) { |
||
List<Character> userInputCharacters = new ArrayList<Character>(); |
List<Character> userInputCharacters = new ArrayList<Character>(); |
||
for ( char ch : aUserInput.toCharArray() ) { |
for ( char ch : aUserInput.toCharArray() ) { |