Advertisement
LucasSousa

Projeto Cubing Timer 1

Dec 16th, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.38 KB | None | 0 0
  1. //PRIMEIRA CLASSE
  2.  
  3. import java.awt.*;
  4. import java.awt.event.*;
  5. import javax.swing.*;
  6.  
  7. public class Testee extends JFrame {
  8.  
  9. static boolean contador = true;
  10. static boolean zerado = false;
  11. final private JButton botão1, botão2, botão3;
  12.  
  13. static JLabel tempoCorrendo;
  14. JLabel label2;
  15.  
  16. Cronometragem running = new Cronometragem(tempoCorrendo);
  17.  
  18. Scramble3x3 scramble1 = new Scramble3x3();
  19.  
  20. public Testee() {
  21.  
  22. setTitle("Cubing Timer");
  23.  
  24. setLayout(new FlowLayout(FlowLayout.LEFT));
  25.  
  26. // Cria um botão com o texto "Clique Aqui"
  27. botão1 = new JButton("Iniciar");
  28. botão2 = new JButton("Parar");
  29. botão3 = new JButton("Reiniciar");
  30.  
  31. botão1.addActionListener(new ActionListener() {
  32.  
  33. @Override
  34. public void actionPerformed(ActionEvent evt) {
  35.  
  36. iniciarActionPerformed(evt);
  37. label2.setText(scramble1.embaralhar3x3());
  38.  
  39. }
  40. });
  41.  
  42. botão2.addActionListener(new ActionListener() {
  43.  
  44. @Override
  45. public void actionPerformed(ActionEvent evt) {
  46.  
  47. pausarActionPerformed(evt);
  48. label2.setText(scramble1.embaralhar3x3());
  49. }
  50. });
  51.  
  52. botão3.addActionListener(new ActionListener() {
  53.  
  54. @Override
  55. public void actionPerformed(ActionEvent evt) {
  56.  
  57. resetarActionPerformed(evt);
  58.  
  59. }
  60. });
  61.  
  62. botão1.setEnabled(false);
  63. botão3.setEnabled(false);
  64.  
  65. label2 = new JLabel();
  66. label2.setText(String.valueOf(scramble1.embaralhar3x3()));
  67. add(label2);
  68.  
  69. tempoCorrendo = new JLabel();
  70. tempoCorrendo.setText("15");
  71. tempoCorrendo.setFont(new Font("Times New Roman", Font.BOLD, 100));
  72. add(tempoCorrendo);
  73.  
  74. // Faz com que o botão "reaja" ao pressionar Enter
  75. reagirSpace(botão1);
  76. reagirSpace(botão2);
  77. reagirSpace(botão3);
  78.  
  79. // Adiciona o botão à janela
  80. add(botão1);
  81. add(botão2);
  82. add(botão3);
  83.  
  84. setSize(500, 250);
  85. setVisible(true);
  86.  
  87. }
  88.  
  89. public static void reagirSpace(JButton buton) {
  90. buton.registerKeyboardAction(
  91. buton.getActionForKeyStroke(
  92. KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)),
  93. KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false), JComponent.WHEN_IN_FOCUSED_WINDOW);
  94.  
  95. buton.registerKeyboardAction(
  96. buton.getActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)), KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true), JComponent.WHEN_IN_FOCUSED_WINDOW);
  97.  
  98. }
  99.  
  100. private void resetarActionPerformed(ActionEvent evt) {
  101. contador = false;
  102. tempoCorrendo.setText("15");
  103. zerado = true;
  104. tempoCorrendo.revalidate();
  105. botão1.setEnabled(true);
  106. botão3.setEnabled(false);
  107.  
  108. }
  109.  
  110. private void iniciarActionPerformed(ActionEvent evt) {
  111. contador = true;
  112. botão1.setEnabled(false);
  113. botão2.setEnabled(true);
  114.  
  115. }
  116.  
  117. private void pausarActionPerformed(ActionEvent evt) {
  118. contador = false;
  119. botão1.setEnabled(false);
  120. botão2.setEnabled(false);
  121. botão3.setEnabled(true);
  122. }
  123.  
  124. public static boolean isContador() {
  125. return contador;
  126. }
  127.  
  128. public static boolean isZerado() {
  129. return zerado;
  130. }
  131.  
  132. public static void setZerado(boolean zero) {
  133. zerado = zero;
  134. }
  135.  
  136. public static void main(String args[]) {
  137. Testee app = new Testee();
  138. app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  139.  
  140. Cronometragem running = new Cronometragem(tempoCorrendo);
  141. running.start();
  142. }
  143. }
  144.  
  145. --------------------------------------------------------------------------
  146.  
  147. //SEGUNDA CLASSE
  148.  
  149.  
  150. import javax.swing.*;
  151.  
  152. public class Cronometragem extends Thread {
  153.  
  154. final private JLabel label;
  155.  
  156. public Cronometragem(JLabel stringTempo) {
  157. this.label = stringTempo;
  158. }
  159.  
  160. @Override
  161. public void run() {
  162.  
  163. try {
  164.  
  165. int segInsp = 15;
  166. int centésimo = 0;
  167. int segundo = 0;
  168. int minuto = 0;
  169.  
  170. do {
  171.  
  172. Thread.sleep(1000);
  173.  
  174. segInsp--;
  175.  
  176. String insp = String.valueOf(segInsp);
  177. if (segInsp == 2) {
  178.  
  179. insp = "+" + String.valueOf(segInsp);
  180.  
  181. }
  182. if (segInsp >= 0 && segInsp <= 1) {
  183.  
  184. insp = "DNF";
  185.  
  186. }
  187.  
  188. this.label.setText(insp);
  189. this.label.revalidate();
  190.  
  191.  
  192. } while (segInsp >= 1);
  193.  
  194. while (true) {
  195.  
  196. Thread.sleep((long) 9.6787);
  197. if (Testee.isContador()) {
  198. if (Testee.isZerado()) {
  199. centésimo = 0;
  200. segundo = 0;
  201. minuto = 0;
  202. Testee.setZerado(false);
  203. }
  204. centésimo++;
  205.  
  206. if (centésimo == 100) {
  207.  
  208. centésimo = 0;
  209. segundo++;
  210. }
  211.  
  212. if (segundo == 60) {
  213.  
  214. segundo = 0;
  215. minuto++;
  216. }
  217.  
  218. String timer
  219. = completaComZero(minuto) + " : " + completaComZero(segundo) + " : " + completaComZero(centésimo);
  220.  
  221. this.label.setText(timer);
  222. this.label.revalidate();
  223.  
  224. }
  225.  
  226. }
  227.  
  228. } catch (InterruptedException e) {
  229.  
  230. }
  231.  
  232. }
  233.  
  234. private String completaComZero(Integer i) {
  235. String retorno = null;
  236. if (i < 10) {
  237. retorno = "0" + i;
  238. } else {
  239. retorno = i.toString();
  240. }
  241. return retorno;
  242. }
  243. }
  244.  
  245. -----------------------------------------------------------
  246.  
  247. //TERCEIRA CLASSE
  248.  
  249.  
  250. import java.util.Arrays;
  251. import java.util.Random;
  252.  
  253.  
  254. public class Scramble3x3 {
  255.  
  256. public static String embaralhar3x3() {
  257.  
  258. Random r = new Random();
  259.  
  260. //Array com todos os movimentos do cubo em seu sentido natural:
  261. String[] globalMoves = {"F", "B", "U", "D", "R", "L"};
  262.  
  263. //Arrays auxiliares:
  264. String[] globalMovesMenosMoves1 = {"U", "D", "R", "L"};
  265. String[] globalMovesMenosMoves2 = {"B", "F", "L", "R"};
  266. String[] globalMovesMenosMoves3 = {"F", "B", "U", "D"};
  267.  
  268. //Array do sentido a qual um movimento será atribuído:
  269. String[] sentido = {" ", "' ", "2 "};
  270.  
  271. //Arrays classificados (sorted) dos movimentos baseados em oposição de faces:
  272. String[] moves1 = {"B", "F"};
  273. String[] moves2 = {"D", "U"};
  274. String[] moves3 = {"L", "R"};
  275.  
  276. //Sorteio do sentido dos movimentos antecipadamente:
  277. String mm1 = sentido[r.nextInt(3)];
  278. String mm2 = sentido[r.nextInt(3)];
  279. String mm3 = sentido[r.nextInt(3)];
  280. String mm4 = sentido[r.nextInt(3)];
  281. String mm5 = sentido[r.nextInt(3)];
  282. String mm6 = sentido[r.nextInt(3)];
  283. String mm7 = sentido[r.nextInt(3)];
  284. String mm8 = sentido[r.nextInt(3)];
  285. String mm9 = sentido[r.nextInt(3)];
  286. String mm10 = sentido[r.nextInt(3)];
  287. String mm11 = sentido[r.nextInt(3)];
  288. String mm12 = sentido[r.nextInt(3)];
  289. String mm13 = sentido[r.nextInt(3)];
  290. String mm14 = sentido[r.nextInt(3)];
  291. String mm15 = sentido[r.nextInt(3)];
  292. String mm16 = sentido[r.nextInt(3)];
  293. String mm17 = sentido[r.nextInt(3)];
  294. String mm18 = sentido[r.nextInt(3)];
  295. String mm19 = sentido[r.nextInt(3)];
  296. String mm20 = sentido[r.nextInt(3)];
  297. String mm21 = sentido[r.nextInt(3)];
  298. String mm22 = sentido[r.nextInt(3)];
  299. String mm23 = sentido[r.nextInt(3)];
  300. String mm24 = sentido[r.nextInt(3)];
  301. String mm25 = sentido[r.nextInt(3)];
  302.  
  303. //Sorteio dos movimentos baseado em todas as restrições cabíveis:
  304. String m1 = globalMoves[r.nextInt(6)];
  305.  
  306. String m2 = "";
  307.  
  308. do {
  309.  
  310. m2 = globalMoves[r.nextInt(6)];
  311. } while (m2 == m1);
  312.  
  313. //-------------------------------------------------------------------------//
  314. boolean opostosOk = false;
  315.  
  316. int testeA = Arrays.binarySearch(moves1, m1);
  317. int testeB = Arrays.binarySearch(moves1, m2);
  318.  
  319. int testeC = Arrays.binarySearch(moves2, m1);
  320. int testeD = Arrays.binarySearch(moves2, m2);
  321.  
  322. int testeE = Arrays.binarySearch(moves3, m1);
  323. int testeF = Arrays.binarySearch(moves3, m2);
  324.  
  325. if ((testeA >= 0 && testeB >= 0) || (testeC >= 0 && testeD >= 0) || (testeE >= 0 && testeF >= 0)) {
  326.  
  327. opostosOk = true;
  328. }
  329.  
  330. String m3 = "";
  331.  
  332. if (opostosOk) {
  333.  
  334. int buscaM11 = Arrays.binarySearch(moves1, m1);
  335. int buscaM12 = Arrays.binarySearch(moves2, m1);
  336. int buscaM13 = Arrays.binarySearch(moves3, m1);
  337.  
  338. if (buscaM11 >= 0) {
  339.  
  340. m3 = globalMovesMenosMoves1[r.nextInt(4)];
  341.  
  342. } else if (buscaM12 >= 0) {
  343.  
  344. m3 = globalMovesMenosMoves2[r.nextInt(4)];
  345.  
  346. } else if (buscaM13 >= 0) {
  347.  
  348. m3 = globalMovesMenosMoves3[r.nextInt(4)];
  349.  
  350. }
  351.  
  352. } else {
  353.  
  354. do {
  355.  
  356. m3 = globalMoves[r.nextInt(6)];
  357.  
  358. } while (m3 == m2);
  359.  
  360. }
  361.  
  362. //-------------------------------------------------------------------------//
  363. boolean opostosOk2 = false;
  364.  
  365. int testeA2 = Arrays.binarySearch(moves1, m2);
  366. int testeB2 = Arrays.binarySearch(moves1, m3);
  367.  
  368. int testeC2 = Arrays.binarySearch(moves2, m2);
  369. int testeD2 = Arrays.binarySearch(moves2, m3);
  370.  
  371. int testeE2 = Arrays.binarySearch(moves3, m2);
  372. int testeF2 = Arrays.binarySearch(moves3, m3);
  373.  
  374. if ((testeA2 >= 0 && testeB2 >= 0) || (testeC2 >= 0 && testeD2 >= 0) || (testeE2 >= 0 && testeF2 >= 0)) {
  375.  
  376. opostosOk2 = true;
  377. }
  378.  
  379. String m4 = "";
  380.  
  381. if (opostosOk2) {
  382.  
  383. int buscaM11 = Arrays.binarySearch(moves1, m2);
  384. int buscaM12 = Arrays.binarySearch(moves2, m2);
  385. int buscaM13 = Arrays.binarySearch(moves3, m2);
  386.  
  387. if (buscaM11 >= 0) {
  388.  
  389. m4 = globalMovesMenosMoves1[r.nextInt(4)];
  390.  
  391. } else if (buscaM12 >= 0) {
  392.  
  393. m4 = globalMovesMenosMoves2[r.nextInt(4)];
  394.  
  395. } else if (buscaM13 >= 0) {
  396.  
  397. m4 = globalMovesMenosMoves3[r.nextInt(4)];
  398.  
  399. }
  400.  
  401. } else {
  402.  
  403. do {
  404.  
  405. m4 = globalMoves[r.nextInt(6)];
  406.  
  407. } while (m4 == m3);
  408.  
  409. }
  410.  
  411. //---------------------------------------------------------------------//
  412. boolean opostosOk3 = false;
  413.  
  414. int testeA3 = Arrays.binarySearch(moves1, m3);
  415. int testeB3 = Arrays.binarySearch(moves1, m4);
  416.  
  417. int testeC3 = Arrays.binarySearch(moves2, m3);
  418. int testeD3 = Arrays.binarySearch(moves2, m4);
  419.  
  420. int testeE3 = Arrays.binarySearch(moves3, m3);
  421. int testeF3 = Arrays.binarySearch(moves3, m4);
  422.  
  423. if ((testeA3 >= 0 && testeB3 >= 0) || (testeC3 >= 0 && testeD3 >= 0) || (testeE3 >= 0 && testeF3 >= 0)) {
  424.  
  425. opostosOk3 = true;
  426. }
  427.  
  428. String m5 = "";
  429.  
  430. if (opostosOk3) {
  431.  
  432. int buscaM11 = Arrays.binarySearch(moves1, m3);
  433. int buscaM12 = Arrays.binarySearch(moves2, m3);
  434. int buscaM13 = Arrays.binarySearch(moves3, m3);
  435.  
  436. if (buscaM11 >= 0) {
  437.  
  438. m5 = globalMovesMenosMoves1[r.nextInt(4)];
  439.  
  440. } else if (buscaM12 >= 0) {
  441.  
  442. m5 = globalMovesMenosMoves2[r.nextInt(4)];
  443.  
  444. } else if (buscaM13 >= 0) {
  445.  
  446. m5 = globalMovesMenosMoves3[r.nextInt(4)];
  447.  
  448. }
  449.  
  450. } else {
  451.  
  452. do {
  453.  
  454. m5 = globalMoves[r.nextInt(6)];
  455.  
  456. } while (m5 == m4);
  457.  
  458. }
  459.  
  460. //-------------------------------------------------------------------//
  461. boolean opostosOk4 = false;
  462.  
  463. int testeA4 = Arrays.binarySearch(moves1, m4);
  464. int testeB4 = Arrays.binarySearch(moves1, m5);
  465.  
  466. int testeC4 = Arrays.binarySearch(moves2, m4);
  467. int testeD4 = Arrays.binarySearch(moves2, m5);
  468.  
  469. int testeE4 = Arrays.binarySearch(moves3, m4);
  470. int testeF4 = Arrays.binarySearch(moves3, m5);
  471.  
  472. if ((testeA4 >= 0 && testeB4 >= 0) || (testeC4 >= 0 && testeD4 >= 0) || (testeE4 >= 0 && testeF4 >= 0)) {
  473.  
  474. opostosOk4 = true;
  475. }
  476.  
  477. String m6 = "";
  478.  
  479. if (opostosOk4) {
  480.  
  481. int buscaM11 = Arrays.binarySearch(moves1, m4);
  482. int buscaM12 = Arrays.binarySearch(moves2, m4);
  483. int buscaM13 = Arrays.binarySearch(moves3, m4);
  484.  
  485. if (buscaM11 >= 0) {
  486.  
  487. m6 = globalMovesMenosMoves1[r.nextInt(4)];
  488.  
  489. } else if (buscaM12 >= 0) {
  490.  
  491. m6 = globalMovesMenosMoves2[r.nextInt(4)];
  492.  
  493. } else if (buscaM13 >= 0) {
  494.  
  495. m6 = globalMovesMenosMoves3[r.nextInt(4)];
  496.  
  497. }
  498.  
  499. } else {
  500.  
  501. do {
  502.  
  503. m6 = globalMoves[r.nextInt(6)];
  504.  
  505. } while (m6 == m5);
  506.  
  507. }
  508.  
  509. //-------------------------------------------------------------------//
  510. boolean opostosOk5 = false;
  511.  
  512. int testeA5 = Arrays.binarySearch(moves1, m5);
  513. int testeB5 = Arrays.binarySearch(moves1, m6);
  514.  
  515. int testeC5 = Arrays.binarySearch(moves2, m5);
  516. int testeD5 = Arrays.binarySearch(moves2, m6);
  517.  
  518. int testeE5 = Arrays.binarySearch(moves3, m4);
  519. int testeF5 = Arrays.binarySearch(moves3, m5);
  520.  
  521. if ((testeA5 >= 0 && testeB5 >= 0) || (testeC5 >= 0 && testeD5 >= 0) || (testeE5 >= 0 && testeF5 >= 0)) {
  522.  
  523. opostosOk5 = true;
  524. }
  525.  
  526. String m7 = "";
  527.  
  528. if (opostosOk5) {
  529.  
  530. int buscaM11 = Arrays.binarySearch(moves1, m5);
  531. int buscaM12 = Arrays.binarySearch(moves2, m5);
  532. int buscaM13 = Arrays.binarySearch(moves3, m5);
  533.  
  534. if (buscaM11 >= 0) {
  535.  
  536. m7 = globalMovesMenosMoves1[r.nextInt(4)];
  537.  
  538. } else if (buscaM12 >= 0) {
  539.  
  540. m7 = globalMovesMenosMoves2[r.nextInt(4)];
  541.  
  542. } else if (buscaM13 >= 0) {
  543.  
  544. m7 = globalMovesMenosMoves3[r.nextInt(4)];
  545.  
  546. }
  547.  
  548. } else {
  549.  
  550. do {
  551.  
  552. m7 = globalMoves[r.nextInt(6)];
  553.  
  554. } while (m7 == m6);
  555.  
  556. }
  557.  
  558. //-------------------------------------------------------------------//
  559. boolean opostosOk6 = false;
  560.  
  561. int testeA6 = Arrays.binarySearch(moves1, m6);
  562. int testeB6 = Arrays.binarySearch(moves1, m7);
  563.  
  564. int testeC6 = Arrays.binarySearch(moves2, m6);
  565. int testeD6 = Arrays.binarySearch(moves2, m7);
  566.  
  567. int testeE6 = Arrays.binarySearch(moves3, m6);
  568. int testeF6 = Arrays.binarySearch(moves3, m7);
  569.  
  570. if ((testeA6 >= 0 && testeB6 >= 0) || (testeC6 >= 0 && testeD6 >= 0) || (testeE6 >= 0 && testeF6 >= 0)) {
  571.  
  572. opostosOk6 = true;
  573. }
  574.  
  575. String m8 = "";
  576.  
  577. if (opostosOk6) {
  578.  
  579. int buscaM11 = Arrays.binarySearch(moves1, m6);
  580. int buscaM12 = Arrays.binarySearch(moves2, m6);
  581. int buscaM13 = Arrays.binarySearch(moves3, m6);
  582.  
  583. if (buscaM11 >= 0) {
  584.  
  585. m8 = globalMovesMenosMoves1[r.nextInt(4)];
  586.  
  587. } else if (buscaM12 >= 0) {
  588.  
  589. m8 = globalMovesMenosMoves2[r.nextInt(4)];
  590.  
  591. } else if (buscaM13 >= 0) {
  592.  
  593. m8 = globalMovesMenosMoves3[r.nextInt(4)];
  594.  
  595. }
  596.  
  597. } else {
  598.  
  599. do {
  600.  
  601. m8 = globalMoves[r.nextInt(6)];
  602.  
  603. } while (m8 == m7);
  604.  
  605. }
  606.  
  607. //-------------------------------------------------------------------//
  608. boolean opostosOk7 = false;
  609.  
  610. int testeA7 = Arrays.binarySearch(moves1, m7);
  611. int testeB7 = Arrays.binarySearch(moves1, m8);
  612.  
  613. int testeC7 = Arrays.binarySearch(moves2, m7);
  614. int testeD7 = Arrays.binarySearch(moves2, m8);
  615.  
  616. int testeE7 = Arrays.binarySearch(moves3, m7);
  617. int testeF7 = Arrays.binarySearch(moves3, m8);
  618.  
  619. if ((testeA7 >= 0 && testeB7 >= 0) || (testeC7 >= 0 && testeD7 >= 0) || (testeE7 >= 0 && testeF7 >= 0)) {
  620.  
  621. opostosOk7 = true;
  622. }
  623.  
  624. String m9 = "";
  625.  
  626. if (opostosOk7) {
  627.  
  628. int buscaM11 = Arrays.binarySearch(moves1, m7);
  629. int buscaM12 = Arrays.binarySearch(moves2, m7);
  630. int buscaM13 = Arrays.binarySearch(moves3, m7);
  631.  
  632. if (buscaM11 >= 0) {
  633.  
  634. m9 = globalMovesMenosMoves1[r.nextInt(4)];
  635.  
  636. } else if (buscaM12 >= 0) {
  637.  
  638. m9 = globalMovesMenosMoves2[r.nextInt(4)];
  639.  
  640. } else if (buscaM13 >= 0) {
  641.  
  642. m9 = globalMovesMenosMoves3[r.nextInt(4)];
  643.  
  644. }
  645.  
  646. } else {
  647.  
  648. do {
  649.  
  650. m9 = globalMoves[r.nextInt(6)];
  651.  
  652. } while (m9 == m8);
  653.  
  654. }
  655.  
  656. //-------------------------------------------------------------------//
  657. boolean opostosOk8 = false;
  658.  
  659. int testeA8 = Arrays.binarySearch(moves1, m8);
  660. int testeB8 = Arrays.binarySearch(moves1, m9);
  661.  
  662. int testeC8 = Arrays.binarySearch(moves2, m8);
  663. int testeD8 = Arrays.binarySearch(moves2, m9);
  664.  
  665. int testeE8 = Arrays.binarySearch(moves3, m8);
  666. int testeF8 = Arrays.binarySearch(moves3, m9);
  667.  
  668. if ((testeA8 >= 0 && testeB8 >= 0) || (testeC8 >= 0 && testeD8 >= 0) || (testeE8 >= 0 && testeF8 >= 0)) {
  669.  
  670. opostosOk8 = true;
  671. }
  672.  
  673. String m10 = "";
  674.  
  675. if (opostosOk8) {
  676.  
  677. int buscaM11 = Arrays.binarySearch(moves1, m8);
  678. int buscaM12 = Arrays.binarySearch(moves2, m8);
  679. int buscaM13 = Arrays.binarySearch(moves3, m8);
  680.  
  681. if (buscaM11 >= 0) {
  682.  
  683. m10 = globalMovesMenosMoves1[r.nextInt(4)];
  684.  
  685. } else if (buscaM12 >= 0) {
  686.  
  687. m10 = globalMovesMenosMoves2[r.nextInt(4)];
  688.  
  689. } else if (buscaM13 >= 0) {
  690.  
  691. m10 = globalMovesMenosMoves3[r.nextInt(4)];
  692.  
  693. }
  694.  
  695. } else {
  696.  
  697. do {
  698.  
  699. m10 = globalMoves[r.nextInt(6)];
  700.  
  701. } while (m10 == m9);
  702.  
  703. }
  704.  
  705. //-------------------------------------------------------------------//
  706. boolean opostosOk9 = false;
  707.  
  708. int testeA9 = Arrays.binarySearch(moves1, m9);
  709. int testeB9 = Arrays.binarySearch(moves1, m10);
  710.  
  711. int testeC9 = Arrays.binarySearch(moves2, m9);
  712. int testeD9 = Arrays.binarySearch(moves2, m10);
  713.  
  714. int testeE9 = Arrays.binarySearch(moves3, m9);
  715. int testeF9 = Arrays.binarySearch(moves3, m10);
  716.  
  717. if ((testeA9 >= 0 && testeB9 >= 0) || (testeC9 >= 0 && testeD9 >= 0) || (testeE9 >= 0 && testeF9 >= 0)) {
  718.  
  719. opostosOk9 = true;
  720. }
  721.  
  722. String m11 = "";
  723.  
  724. if (opostosOk9) {
  725.  
  726. int buscaM11 = Arrays.binarySearch(moves1, m9);
  727. int buscaM12 = Arrays.binarySearch(moves2, m9);
  728. int buscaM13 = Arrays.binarySearch(moves3, m9);
  729.  
  730. if (buscaM11 >= 0) {
  731.  
  732. m11 = globalMovesMenosMoves1[r.nextInt(4)];
  733.  
  734. } else if (buscaM12 >= 0) {
  735.  
  736. m11 = globalMovesMenosMoves2[r.nextInt(4)];
  737.  
  738. } else if (buscaM13 >= 0) {
  739.  
  740. m11 = globalMovesMenosMoves3[r.nextInt(4)];
  741.  
  742. }
  743.  
  744. } else {
  745.  
  746. do {
  747.  
  748. m11 = globalMoves[r.nextInt(6)];
  749.  
  750. } while (m11 == m10);
  751.  
  752. }
  753.  
  754. //-------------------------------------------------------------------//
  755. boolean opostosOk10 = false;
  756.  
  757. int testeA10 = Arrays.binarySearch(moves1, m10);
  758. int testeB10 = Arrays.binarySearch(moves1, m11);
  759.  
  760. int testeC10 = Arrays.binarySearch(moves2, m10);
  761. int testeD10 = Arrays.binarySearch(moves2, m11);
  762.  
  763. int testeE10 = Arrays.binarySearch(moves3, m10);
  764. int testeF10 = Arrays.binarySearch(moves3, m11);
  765.  
  766. if ((testeA10 >= 0 && testeB10 >= 0) || (testeC10 >= 0 && testeD10 >= 0) || (testeE10 >= 0 && testeF10 >= 0)) {
  767.  
  768. opostosOk10 = true;
  769. }
  770.  
  771. String m12 = "";
  772.  
  773. if (opostosOk10) {
  774.  
  775. int buscaM11 = Arrays.binarySearch(moves1, m10);
  776. int buscaM12 = Arrays.binarySearch(moves2, m10);
  777. int buscaM13 = Arrays.binarySearch(moves3, m10);
  778.  
  779. if (buscaM11 >= 0) {
  780.  
  781. m12 = globalMovesMenosMoves1[r.nextInt(4)];
  782.  
  783. } else if (buscaM12 >= 0) {
  784.  
  785. m12 = globalMovesMenosMoves2[r.nextInt(4)];
  786.  
  787. } else if (buscaM13 >= 0) {
  788.  
  789. m12 = globalMovesMenosMoves3[r.nextInt(4)];
  790.  
  791. }
  792.  
  793. } else {
  794.  
  795. do {
  796.  
  797. m12 = globalMoves[r.nextInt(6)];
  798.  
  799. } while (m12 == m11);
  800.  
  801. }
  802.  
  803. //-------------------------------------------------------------------//
  804. boolean opostosOk11 = false;
  805.  
  806. int testeA11 = Arrays.binarySearch(moves1, m11);
  807. int testeB11 = Arrays.binarySearch(moves1, m12);
  808.  
  809. int testeC11 = Arrays.binarySearch(moves2, m11);
  810. int testeD11 = Arrays.binarySearch(moves2, m12);
  811.  
  812. int testeE11 = Arrays.binarySearch(moves3, m11);
  813. int testeF11 = Arrays.binarySearch(moves3, m12);
  814.  
  815. if ((testeA11 >= 0 && testeB11 >= 0) || (testeC11 >= 0 && testeD11 >= 0) || (testeE11 >= 0 && testeF11 >= 0)) {
  816.  
  817. opostosOk11 = true;
  818. }
  819.  
  820. String m13 = "";
  821.  
  822. if (opostosOk11) {
  823.  
  824. int buscaM11 = Arrays.binarySearch(moves1, m11);
  825. int buscaM12 = Arrays.binarySearch(moves2, m11);
  826. int buscaM13 = Arrays.binarySearch(moves3, m11);
  827.  
  828. if (buscaM11 >= 0) {
  829.  
  830. m13 = globalMovesMenosMoves1[r.nextInt(4)];
  831.  
  832. } else if (buscaM12 >= 0) {
  833.  
  834. m13 = globalMovesMenosMoves2[r.nextInt(4)];
  835.  
  836. } else if (buscaM13 >= 0) {
  837.  
  838. m13 = globalMovesMenosMoves3[r.nextInt(4)];
  839.  
  840. }
  841.  
  842. } else {
  843.  
  844. do {
  845.  
  846. m13 = globalMoves[r.nextInt(6)];
  847.  
  848. } while (m13 == m12);
  849.  
  850. }
  851.  
  852. //-------------------------------------------------------------------//
  853. boolean opostosOk12 = false;
  854.  
  855. int testeA12 = Arrays.binarySearch(moves1, m12);
  856. int testeB12 = Arrays.binarySearch(moves1, m13);
  857.  
  858. int testeC12 = Arrays.binarySearch(moves2, m12);
  859. int testeD12 = Arrays.binarySearch(moves2, m13);
  860.  
  861. int testeE12 = Arrays.binarySearch(moves3, m12);
  862. int testeF12 = Arrays.binarySearch(moves3, m13);
  863.  
  864. if ((testeA12 >= 0 && testeB12 >= 0) || (testeC12 >= 0 && testeD12 >= 0) || (testeE12 >= 0 && testeF12 >= 0)) {
  865.  
  866. opostosOk12 = true;
  867. }
  868.  
  869. String m14 = "";
  870.  
  871. if (opostosOk12) {
  872.  
  873. int buscaM11 = Arrays.binarySearch(moves1, m12);
  874. int buscaM12 = Arrays.binarySearch(moves2, m12);
  875. int buscaM13 = Arrays.binarySearch(moves3, m12);
  876.  
  877. if (buscaM11 >= 0) {
  878.  
  879. m14 = globalMovesMenosMoves1[r.nextInt(4)];
  880.  
  881. } else if (buscaM12 >= 0) {
  882.  
  883. m14 = globalMovesMenosMoves2[r.nextInt(4)];
  884.  
  885. } else if (buscaM13 >= 0) {
  886.  
  887. m14 = globalMovesMenosMoves3[r.nextInt(4)];
  888.  
  889. }
  890.  
  891. } else {
  892.  
  893. do {
  894.  
  895. m14 = globalMoves[r.nextInt(6)];
  896.  
  897. } while (m14 == m13);
  898.  
  899. }
  900.  
  901. //-------------------------------------------------------------------//
  902. boolean opostosOk13 = false;
  903.  
  904. int testeA13 = Arrays.binarySearch(moves1, m13);
  905. int testeB13 = Arrays.binarySearch(moves1, m14);
  906.  
  907. int testeC13 = Arrays.binarySearch(moves2, m13);
  908. int testeD13 = Arrays.binarySearch(moves2, m14);
  909.  
  910. int testeE13 = Arrays.binarySearch(moves3, m13);
  911. int testeF13 = Arrays.binarySearch(moves3, m14);
  912.  
  913. if ((testeA13 >= 0 && testeB13 >= 0) || (testeC13 >= 0 && testeD13 >= 0) || (testeE13 >= 0 && testeF13 >= 0)) {
  914.  
  915. opostosOk13 = true;
  916. }
  917.  
  918. String m15 = "";
  919.  
  920. if (opostosOk13) {
  921.  
  922. int buscaM11 = Arrays.binarySearch(moves1, m13);
  923. int buscaM12 = Arrays.binarySearch(moves2, m13);
  924. int buscaM13 = Arrays.binarySearch(moves3, m13);
  925.  
  926. if (buscaM11 >= 0) {
  927.  
  928. m15 = globalMovesMenosMoves1[r.nextInt(4)];
  929.  
  930. } else if (buscaM12 >= 0) {
  931.  
  932. m15 = globalMovesMenosMoves2[r.nextInt(4)];
  933.  
  934. } else if (buscaM13 >= 0) {
  935.  
  936. m15 = globalMovesMenosMoves3[r.nextInt(4)];
  937.  
  938. }
  939.  
  940. } else {
  941.  
  942. do {
  943.  
  944. m15 = globalMoves[r.nextInt(6)];
  945.  
  946. } while (m15 == m14);
  947.  
  948. }
  949.  
  950. //-------------------------------------------------------------------//
  951. boolean opostosOk14 = false;
  952.  
  953. int testeA14 = Arrays.binarySearch(moves1, m14);
  954. int testeB14 = Arrays.binarySearch(moves1, m15);
  955.  
  956. int testeC14 = Arrays.binarySearch(moves2, m14);
  957. int testeD14 = Arrays.binarySearch(moves2, m15);
  958.  
  959. int testeE14 = Arrays.binarySearch(moves3, m14);
  960. int testeF14 = Arrays.binarySearch(moves3, m15);
  961.  
  962. if ((testeA14 >= 0 && testeB14 >= 0) || (testeC14 >= 0 && testeD14 >= 0) || (testeE14 >= 0 && testeF14 >= 0)) {
  963.  
  964. opostosOk14 = true;
  965. }
  966.  
  967. String m16 = "";
  968.  
  969. if (opostosOk14) {
  970.  
  971. int buscaM11 = Arrays.binarySearch(moves1, m14);
  972. int buscaM12 = Arrays.binarySearch(moves2, m14);
  973. int buscaM13 = Arrays.binarySearch(moves3, m14);
  974.  
  975. if (buscaM11 >= 0) {
  976.  
  977. m16 = globalMovesMenosMoves1[r.nextInt(4)];
  978.  
  979. } else if (buscaM12 >= 0) {
  980.  
  981. m16 = globalMovesMenosMoves2[r.nextInt(4)];
  982.  
  983. } else if (buscaM13 >= 0) {
  984.  
  985. m16 = globalMovesMenosMoves3[r.nextInt(4)];
  986.  
  987. }
  988.  
  989. } else {
  990.  
  991. do {
  992.  
  993. m16 = globalMoves[r.nextInt(6)];
  994.  
  995. } while (m16 == m15);
  996.  
  997. }
  998.  
  999. //-------------------------------------------------------------------//
  1000. boolean opostosOk15 = false;
  1001.  
  1002. int testeA15 = Arrays.binarySearch(moves1, m15);
  1003. int testeB15 = Arrays.binarySearch(moves1, m16);
  1004.  
  1005. int testeC15 = Arrays.binarySearch(moves2, m15);
  1006. int testeD15 = Arrays.binarySearch(moves2, m16);
  1007.  
  1008. int testeE15 = Arrays.binarySearch(moves3, m15);
  1009. int testeF15 = Arrays.binarySearch(moves3, m16);
  1010.  
  1011. if ((testeA15 >= 0 && testeB15 >= 0) || (testeC15 >= 0 && testeD15 >= 0) || (testeE15 >= 0 && testeF15 >= 0)) {
  1012.  
  1013. opostosOk15 = true;
  1014. }
  1015.  
  1016. String m17 = "";
  1017.  
  1018. if (opostosOk15) {
  1019.  
  1020. int buscaM11 = Arrays.binarySearch(moves1, m15);
  1021. int buscaM12 = Arrays.binarySearch(moves2, m15);
  1022. int buscaM13 = Arrays.binarySearch(moves3, m15);
  1023.  
  1024. if (buscaM11 >= 0) {
  1025.  
  1026. m17 = globalMovesMenosMoves1[r.nextInt(4)];
  1027.  
  1028. } else if (buscaM12 >= 0) {
  1029.  
  1030. m17 = globalMovesMenosMoves2[r.nextInt(4)];
  1031.  
  1032. } else if (buscaM13 >= 0) {
  1033.  
  1034. m17 = globalMovesMenosMoves3[r.nextInt(4)];
  1035.  
  1036. }
  1037.  
  1038. } else {
  1039.  
  1040. do {
  1041.  
  1042. m17 = globalMoves[r.nextInt(6)];
  1043.  
  1044. } while (m17 == m16);
  1045.  
  1046. }
  1047.  
  1048. //-------------------------------------------------------------------//
  1049. boolean opostosOk16 = false;
  1050.  
  1051. int testeA16 = Arrays.binarySearch(moves1, m16);
  1052. int testeB16 = Arrays.binarySearch(moves1, m17);
  1053.  
  1054. int testeC16 = Arrays.binarySearch(moves2, m16);
  1055. int testeD16 = Arrays.binarySearch(moves2, m17);
  1056.  
  1057. int testeE16 = Arrays.binarySearch(moves3, m16);
  1058. int testeF16 = Arrays.binarySearch(moves3, m17);
  1059.  
  1060. if ((testeA16 >= 0 && testeB16 >= 0) || (testeC16 >= 0 && testeD16 >= 0) || (testeE16 >= 0 && testeF16 >= 0)) {
  1061.  
  1062. opostosOk16 = true;
  1063. }
  1064.  
  1065. String m18 = "";
  1066.  
  1067. if (opostosOk16) {
  1068.  
  1069. int buscaM11 = Arrays.binarySearch(moves1, m16);
  1070. int buscaM12 = Arrays.binarySearch(moves2, m16);
  1071. int buscaM13 = Arrays.binarySearch(moves3, m16);
  1072.  
  1073. if (buscaM11 >= 0) {
  1074.  
  1075. m18 = globalMovesMenosMoves1[r.nextInt(4)];
  1076.  
  1077. } else if (buscaM12 >= 0) {
  1078.  
  1079. m18 = globalMovesMenosMoves2[r.nextInt(4)];
  1080.  
  1081. } else if (buscaM13 >= 0) {
  1082.  
  1083. m18 = globalMovesMenosMoves3[r.nextInt(4)];
  1084.  
  1085. }
  1086.  
  1087. } else {
  1088.  
  1089. do {
  1090.  
  1091. m18 = globalMoves[r.nextInt(6)];
  1092.  
  1093. } while (m18 == m17);
  1094.  
  1095. }
  1096.  
  1097. //-------------------------------------------------------------------//
  1098. boolean opostosOk17 = false;
  1099.  
  1100. int testeA17 = Arrays.binarySearch(moves1, m17);
  1101. int testeB17 = Arrays.binarySearch(moves1, m18);
  1102.  
  1103. int testeC17 = Arrays.binarySearch(moves2, m17);
  1104. int testeD17 = Arrays.binarySearch(moves2, m18);
  1105.  
  1106. int testeE17 = Arrays.binarySearch(moves3, m17);
  1107. int testeF17 = Arrays.binarySearch(moves3, m18);
  1108.  
  1109. if ((testeA17 >= 0 && testeB17 >= 0) || (testeC17 >= 0 && testeD17 >= 0) || (testeE17 >= 0 && testeF17 >= 0)) {
  1110.  
  1111. opostosOk17 = true;
  1112. }
  1113.  
  1114. String m19 = "";
  1115.  
  1116. if (opostosOk17) {
  1117.  
  1118. int buscaM11 = Arrays.binarySearch(moves1, m17);
  1119. int buscaM12 = Arrays.binarySearch(moves2, m17);
  1120. int buscaM13 = Arrays.binarySearch(moves3, m17);
  1121.  
  1122. if (buscaM11 >= 0) {
  1123.  
  1124. m19 = globalMovesMenosMoves1[r.nextInt(4)];
  1125.  
  1126. } else if (buscaM12 >= 0) {
  1127.  
  1128. m19 = globalMovesMenosMoves2[r.nextInt(4)];
  1129.  
  1130. } else if (buscaM13 >= 0) {
  1131.  
  1132. m19 = globalMovesMenosMoves3[r.nextInt(4)];
  1133.  
  1134. }
  1135.  
  1136. } else {
  1137.  
  1138. do {
  1139.  
  1140. m19 = globalMoves[r.nextInt(6)];
  1141.  
  1142. } while (m19 == m18);
  1143.  
  1144. }
  1145.  
  1146. //-------------------------------------------------------------------//
  1147. boolean opostosOk18 = false;
  1148.  
  1149. int testeA18 = Arrays.binarySearch(moves1, m18);
  1150. int testeB18 = Arrays.binarySearch(moves1, m19);
  1151.  
  1152. int testeC18 = Arrays.binarySearch(moves2, m18);
  1153. int testeD18 = Arrays.binarySearch(moves2, m19);
  1154.  
  1155. int testeE18 = Arrays.binarySearch(moves3, m18);
  1156. int testeF18 = Arrays.binarySearch(moves3, m19);
  1157.  
  1158. if ((testeA18 >= 0 && testeB18 >= 0) || (testeC18 >= 0 && testeD18 >= 0) || (testeE18 >= 0 && testeF18 >= 0)) {
  1159.  
  1160. opostosOk18 = true;
  1161. }
  1162.  
  1163. String m20 = "";
  1164.  
  1165. if (opostosOk18) {
  1166.  
  1167. int buscaM11 = Arrays.binarySearch(moves1, m18);
  1168. int buscaM12 = Arrays.binarySearch(moves2, m18);
  1169. int buscaM13 = Arrays.binarySearch(moves3, m18);
  1170.  
  1171. if (buscaM11 >= 0) {
  1172.  
  1173. m20 = globalMovesMenosMoves1[r.nextInt(4)];
  1174.  
  1175. } else if (buscaM12 >= 0) {
  1176.  
  1177. m20 = globalMovesMenosMoves2[r.nextInt(4)];
  1178.  
  1179. } else if (buscaM13 >= 0) {
  1180.  
  1181. m20 = globalMovesMenosMoves3[r.nextInt(4)];
  1182.  
  1183. }
  1184.  
  1185. } else {
  1186.  
  1187. do {
  1188.  
  1189. m20 = globalMoves[r.nextInt(6)];
  1190.  
  1191. } while (m20 == m19);
  1192.  
  1193. }
  1194.  
  1195. //-------------------------------------------------------------------//
  1196. boolean opostosOk19 = false;
  1197.  
  1198. int testeA19 = Arrays.binarySearch(moves1, m19);
  1199. int testeB19 = Arrays.binarySearch(moves1, m20);
  1200.  
  1201. int testeC19 = Arrays.binarySearch(moves2, m19);
  1202. int testeD19 = Arrays.binarySearch(moves2, m20);
  1203.  
  1204. int testeE19 = Arrays.binarySearch(moves3, m19);
  1205. int testeF19 = Arrays.binarySearch(moves3, m20);
  1206.  
  1207. if ((testeA19 >= 0 && testeB19 >= 0) || (testeC19 >= 0 && testeD19 >= 0) || (testeE19 >= 0 && testeF19 >= 0)) {
  1208.  
  1209. opostosOk19 = true;
  1210. }
  1211.  
  1212. String m21 = "";
  1213.  
  1214. if (opostosOk19) {
  1215.  
  1216. int buscaM11 = Arrays.binarySearch(moves1, m19);
  1217. int buscaM12 = Arrays.binarySearch(moves2, m19);
  1218. int buscaM13 = Arrays.binarySearch(moves3, m19);
  1219.  
  1220. if (buscaM11 >= 0) {
  1221.  
  1222. m21 = globalMovesMenosMoves1[r.nextInt(4)];
  1223.  
  1224. } else if (buscaM12 >= 0) {
  1225.  
  1226. m21 = globalMovesMenosMoves2[r.nextInt(4)];
  1227.  
  1228. } else if (buscaM13 >= 0) {
  1229.  
  1230. m21 = globalMovesMenosMoves3[r.nextInt(4)];
  1231.  
  1232. }
  1233.  
  1234. } else {
  1235.  
  1236. do {
  1237.  
  1238. m21 = globalMoves[r.nextInt(6)];
  1239.  
  1240. } while (m21 == m20);
  1241.  
  1242. }
  1243.  
  1244. //-------------------------------------------------------------------//
  1245. boolean opostosOk20 = false;
  1246.  
  1247. int testeA20 = Arrays.binarySearch(moves1, m20);
  1248. int testeB20 = Arrays.binarySearch(moves1, m21);
  1249.  
  1250. int testeC20 = Arrays.binarySearch(moves2, m20);
  1251. int testeD20 = Arrays.binarySearch(moves2, m21);
  1252.  
  1253. int testeE20 = Arrays.binarySearch(moves3, m20);
  1254. int testeF20 = Arrays.binarySearch(moves3, m21);
  1255.  
  1256. if ((testeA20 >= 0 && testeB20 >= 0) || (testeC20 >= 0 && testeD20 >= 0) || (testeE20 >= 0 && testeF20 >= 0)) {
  1257.  
  1258. opostosOk20 = true;
  1259. }
  1260.  
  1261. String m22 = "";
  1262.  
  1263. if (opostosOk20) {
  1264.  
  1265. int buscaM11 = Arrays.binarySearch(moves1, m20);
  1266. int buscaM12 = Arrays.binarySearch(moves2, m20);
  1267. int buscaM13 = Arrays.binarySearch(moves3, m20);
  1268.  
  1269. if (buscaM11 >= 0) {
  1270.  
  1271. m22 = globalMovesMenosMoves1[r.nextInt(4)];
  1272.  
  1273. } else if (buscaM12 >= 0) {
  1274.  
  1275. m22 = globalMovesMenosMoves2[r.nextInt(4)];
  1276.  
  1277. } else if (buscaM13 >= 0) {
  1278.  
  1279. m22 = globalMovesMenosMoves3[r.nextInt(4)];
  1280.  
  1281. }
  1282.  
  1283. } else {
  1284.  
  1285. do {
  1286.  
  1287. m22 = globalMoves[r.nextInt(6)];
  1288.  
  1289. } while (m22 == m21);
  1290.  
  1291. }
  1292.  
  1293. //-------------------------------------------------------------------//
  1294. boolean opostosOk21 = false;
  1295.  
  1296. int testeA21 = Arrays.binarySearch(moves1, m21);
  1297. int testeB21 = Arrays.binarySearch(moves1, m22);
  1298.  
  1299. int testeC21 = Arrays.binarySearch(moves2, m21);
  1300. int testeD21 = Arrays.binarySearch(moves2, m22);
  1301.  
  1302. int testeE21 = Arrays.binarySearch(moves3, m21);
  1303. int testeF21 = Arrays.binarySearch(moves3, m22);
  1304.  
  1305. if ((testeA21 >= 0 && testeB21 >= 0) || (testeC21 >= 0 && testeD21 >= 0) || (testeE21 >= 0 && testeF21 >= 0)) {
  1306.  
  1307. opostosOk21 = true;
  1308. }
  1309.  
  1310. String m23 = "";
  1311.  
  1312. if (opostosOk21) {
  1313.  
  1314. int buscaM11 = Arrays.binarySearch(moves1, m21);
  1315. int buscaM12 = Arrays.binarySearch(moves2, m21);
  1316. int buscaM13 = Arrays.binarySearch(moves3, m21);
  1317.  
  1318. if (buscaM11 >= 0) {
  1319.  
  1320. m23 = globalMovesMenosMoves1[r.nextInt(4)];
  1321.  
  1322. } else if (buscaM12 >= 0) {
  1323.  
  1324. m23 = globalMovesMenosMoves2[r.nextInt(4)];
  1325.  
  1326. } else if (buscaM13 >= 0) {
  1327.  
  1328. m23 = globalMovesMenosMoves3[r.nextInt(4)];
  1329.  
  1330. }
  1331.  
  1332. } else {
  1333.  
  1334. do {
  1335.  
  1336. m23 = globalMoves[r.nextInt(6)];
  1337.  
  1338. } while (m23 == m22);
  1339.  
  1340. }
  1341.  
  1342. //-------------------------------------------------------------------//
  1343. boolean opostosOk22 = false;
  1344.  
  1345. int testeA22 = Arrays.binarySearch(moves1, m22);
  1346. int testeB22 = Arrays.binarySearch(moves1, m23);
  1347.  
  1348. int testeC22 = Arrays.binarySearch(moves2, m22);
  1349. int testeD22 = Arrays.binarySearch(moves2, m23);
  1350.  
  1351. int testeE22 = Arrays.binarySearch(moves3, m22);
  1352. int testeF22 = Arrays.binarySearch(moves3, m23);
  1353.  
  1354. if ((testeA22 >= 0 && testeB22 >= 0) || (testeC22 >= 0 && testeD22 >= 0) || (testeE22 >= 0 && testeF22 >= 0)) {
  1355.  
  1356. opostosOk22 = true;
  1357. }
  1358.  
  1359. String m24 = "";
  1360.  
  1361. if (opostosOk22) {
  1362.  
  1363. int buscaM11 = Arrays.binarySearch(moves1, m22);
  1364. int buscaM12 = Arrays.binarySearch(moves2, m22);
  1365. int buscaM13 = Arrays.binarySearch(moves3, m22);
  1366.  
  1367. if (buscaM11 >= 0) {
  1368.  
  1369. m24 = globalMovesMenosMoves1[r.nextInt(4)];
  1370.  
  1371. } else if (buscaM12 >= 0) {
  1372.  
  1373. m24 = globalMovesMenosMoves2[r.nextInt(4)];
  1374.  
  1375. } else if (buscaM13 >= 0) {
  1376.  
  1377. m24 = globalMovesMenosMoves3[r.nextInt(4)];
  1378.  
  1379. }
  1380.  
  1381. } else {
  1382.  
  1383. do {
  1384.  
  1385. m24 = globalMoves[r.nextInt(6)];
  1386.  
  1387. } while (m24 == m23);
  1388.  
  1389. }
  1390.  
  1391. //-------------------------------------------------------------------//
  1392. boolean opostosOk23 = false;
  1393.  
  1394. int testeA23 = Arrays.binarySearch(moves1, m23);
  1395. int testeB23 = Arrays.binarySearch(moves1, m24);
  1396.  
  1397. int testeC23 = Arrays.binarySearch(moves2, m23);
  1398. int testeD23 = Arrays.binarySearch(moves2, m24);
  1399.  
  1400. int testeE23 = Arrays.binarySearch(moves3, m23);
  1401. int testeF23 = Arrays.binarySearch(moves3, m24);
  1402.  
  1403. if ((testeA23 >= 0 && testeB23 >= 0) || (testeC23 >= 0 && testeD23 >= 0) || (testeE23 >= 0 && testeF23 >= 0)) {
  1404.  
  1405. opostosOk23 = true;
  1406. }
  1407.  
  1408. String m25 = "";
  1409.  
  1410. if (opostosOk23) {
  1411.  
  1412. int buscaM11 = Arrays.binarySearch(moves1, m23);
  1413. int buscaM12 = Arrays.binarySearch(moves2, m23);
  1414. int buscaM13 = Arrays.binarySearch(moves3, m23);
  1415.  
  1416. if (buscaM11 >= 0) {
  1417.  
  1418. m25 = globalMovesMenosMoves1[r.nextInt(4)];
  1419.  
  1420. } else if (buscaM12 >= 0) {
  1421.  
  1422. m25 = globalMovesMenosMoves2[r.nextInt(4)];
  1423.  
  1424. } else if (buscaM13 >= 0) {
  1425.  
  1426. m25 = globalMovesMenosMoves3[r.nextInt(4)];
  1427.  
  1428. }
  1429.  
  1430. } else {
  1431.  
  1432. do {
  1433.  
  1434. m25 = globalMoves[r.nextInt(6)];
  1435.  
  1436. } while (m25 == m24);
  1437.  
  1438. }
  1439.  
  1440. //-------------------------------------------------------------------//
  1441. String moves = m1 + mm1 + m2 + mm2 + m3 + mm3 + m4 + mm4 + m5
  1442. + mm5 + m6 + mm6 + m7 + mm7 + m8 + mm8 + m9 + mm9 + m10
  1443. + mm10 + m11 + mm11 + m12 + mm12 + m13 + mm13 + m14
  1444. + mm14 + m15 + mm15 + m16 + mm16 + m17 + mm17 + m18
  1445. + mm18 + m19 + mm19 + m20 + mm20 + m21 + mm21 + m22
  1446. + mm22 + m23 + mm23 + m24 + mm24 + m25 + mm25;
  1447.  
  1448. return moves;
  1449. }
  1450.  
  1451. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement