Guest User

Untitled

a guest
May 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. boolean inSolution = false;
  2. if (row == 1) {
  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. for (int i = 0; i < 4; i++) {
  26.  
  27. if (solution[i].equals(colors[0][i])) {
  28. s = "1" + s;
  29. }
  30. else
  31. {
  32.  
  33. for (int j = 0; j < 4; j++)
  34. {
  35. if(colors[0][i].equals(solution[j]))
  36. {
  37. inSolution = true;
  38. }
  39. }
  40.  
  41. if(inSolution == true)
  42. {
  43. s = s + "0";
  44. }
  45. else
  46. {
  47. s = s + "2";
  48. }
  49.  
  50. }
  51. if(colors[0][i].equals("1111"))
  52. {
  53. //something
  54.  
  55. }
  56.  
  57.  
  58.  
  59. }
  60.  
  61.  
  62. jLabel2.setText(s);
  63. row++;
  64. System.out.println(row);
  65.  
  66. }
  67.  
  68. if (row == 2) {
  69. String r2c1 = jTextField7.getText();
  70. String r2c2 = jTextField8.getText();
  71. String r2c3 = jTextField5.getText();
  72. String r2c4 = jTextField6.getText();
  73.  
  74. //r = row c = column
  75. for (int q = 0; q < 4; q++) {
  76. if (q == 0) {
  77. colors[1][q] = r2c1;
  78. }
  79. if (q == 1) {
  80. colors[1][q] = r2c2;
  81. }
  82. if (q == 2) {
  83. colors[1][q] = r2c3;
  84. }
  85. if (q == 3) {
  86. colors[1][q] = r2c4;
  87. }
  88. }
  89.  
  90. String r = "";
  91. for (int i = 0; i < 4; i++) {
  92.  
  93. if (solution[i].equals(colors[1][i])) {
  94. r = "1" + r;
  95. }
  96. else
  97. {
  98.  
  99. for (int j = 0; j < 4; j++)
  100. {
  101. if(colors[1][i].equals(solution[j]))
  102. {
  103. inSolution = true;
  104. }
  105. }
  106.  
  107. if(inSolution == true)
  108. {
  109. r = r + "0";
  110. }
  111. else
  112. {
  113. r = r + "2";
  114. }
  115.  
  116. }
  117. if(colors[1][i].equals("1111"))
  118. {
  119. //something
  120.  
  121. }
  122.  
  123. jLabel3.setText(r);
  124.  
  125.  
  126. }
  127.  
  128.  
  129. row++;
  130.  
  131. }
  132.  
  133.  
  134.  
  135. */
Add Comment
Please, Sign In to add comment