Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean inSolution = false;
- if (row == 1) {
- 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 = "";
- 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][i].equals(solution[j]))
- {
- inSolution = true;
- }
- }
- if(inSolution == true)
- {
- s = s + "0";
- }
- else
- {
- s = s + "2";
- }
- }
- if(colors[0][i].equals("1111"))
- {
- //something
- }
- }
- jLabel2.setText(s);
- row++;
- System.out.println(row);
- }
- if (row == 2) {
- String r2c1 = jTextField7.getText();
- String r2c2 = jTextField8.getText();
- String r2c3 = jTextField5.getText();
- String r2c4 = jTextField6.getText();
- //r = row c = column
- for (int q = 0; q < 4; q++) {
- if (q == 0) {
- colors[1][q] = r2c1;
- }
- if (q == 1) {
- colors[1][q] = r2c2;
- }
- if (q == 2) {
- colors[1][q] = r2c3;
- }
- if (q == 3) {
- colors[1][q] = r2c4;
- }
- }
- String r = "";
- for (int i = 0; i < 4; i++) {
- if (solution[i].equals(colors[1][i])) {
- r = "1" + r;
- }
- else
- {
- for (int j = 0; j < 4; j++)
- {
- if(colors[1][i].equals(solution[j]))
- {
- inSolution = true;
- }
- }
- if(inSolution == true)
- {
- r = r + "0";
- }
- else
- {
- r = r + "2";
- }
- }
- if(colors[1][i].equals("1111"))
- {
- //something
- }
- jLabel3.setText(r);
- }
- row++;
- }
- */
Add Comment
Please, Sign In to add comment