Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean inSolution = false;
- if (row == 0) {
- String r1c1 = jTextField3.getText();
- String r1c2 = jTextField4.getText();
- String r1c3 = jTextField2.getText();
- String r1c4 = jTextField1.getText();
- //r = row c = column
- for (int q = 0; q < 4; q++) {
- if (q == 0) {
- colors[0][q] = r1c1;
- }
- if (q == 1) {
- colors[0][q] = r1c2;
- }
- if (q == 2) {
- colors[0][q] = r1c3;
- }
- if (q == 3) {
- colors[0][q] = r1c4;
- }
- }
- String s = "";
- int value = 0; //when value is 4, it shows the solution
- for (int i = 0; i < 4; i++) {
- if (solution[i].equals(colors[0][i])) {
- s = "1" + s;
- } else {
- for (int j = 0; j < 4; j++) {
- if (colors[0][j].equals(solution[j])) {
- inSolution = true;
- if (inSolution == true) {
- s = s + "0";
- inSolution = false;
- System.out.println("hi");
- } else {
- s = s + "2";
- System.out.println("bye");
- }
- }
- }
- }
- }
- jLabel2.setText(s);
- row++;
- }
Add Comment
Please, Sign In to add comment