Guest User

Untitled

a guest
May 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. boolean inSolution = false;
  2. if (row == 0) {
  3. String r1c1 = jTextField3.getText();
  4. String r1c2 = jTextField4.getText();
  5. String r1c3 = jTextField2.getText();
  6. String r1c4 = jTextField1.getText();
  7.  
  8. //r = row c = column
  9. for (int q = 0; q < 4; q++) {
  10. if (q == 0) {
  11. colors[0][q] = r1c1;
  12. }
  13. if (q == 1) {
  14. colors[0][q] = r1c2;
  15. }
  16. if (q == 2) {
  17. colors[0][q] = r1c3;
  18. }
  19. if (q == 3) {
  20. colors[0][q] = r1c4;
  21. }
  22. }
  23.  
  24. String s = "";
  25. int value = 0; //when value is 4, it shows the solution
  26. for (int i = 0; i < 4; i++) {
  27.  
  28. if (solution[i].equals(colors[0][i])) {
  29. s = "1" + s;
  30. } else {
  31.  
  32. for (int j = 0; j < 4; j++) {
  33. if (colors[0][j].equals(solution[j])) {
  34.  
  35. inSolution = true;
  36.  
  37.  
  38. if (inSolution == true) {
  39. s = s + "0";
  40. inSolution = false;
  41. System.out.println("hi");
  42. } else {
  43. s = s + "2";
  44. System.out.println("bye");
  45.  
  46. }
  47.  
  48. }
  49.  
  50. }
  51.  
  52.  
  53. }
  54. }
  55. jLabel2.setText(s);
  56. row++;
  57.  
  58. }
Add Comment
Please, Sign In to add comment