Created
September 29, 2017 02:09
-
-
Save viveknarang/5fc2c6088b028722fb2a70450117888f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class SimonSays { | |
public static void main (String [] args) { | |
String simonPattern = ""; | |
String userPattern = ""; | |
int userScore = 0; | |
int i = 0; | |
userScore = 0; | |
simonPattern = "RRGBRYYBGY"; | |
userPattern = "RRGBBRYBGY"; | |
/* Your solution goes here */ | |
for (i = 0 ; i < simonPattern.length(); i++) { | |
if (simonPattern.charAt(i) == userPattern.charAt(i)) { | |
userScore++; | |
} else { | |
break; | |
} | |
} | |
System.out.println("userScore: " + userScore); | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment