Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. if (jogada == 0) {
  2. //procurar linha e coluna que só tenham jogadas do adversário
  3. //caso encontre joga nessa linha / coluna
  4. int ljogada = 0;
  5. int cjogada = 0;
  6. for (int c = 1; c < 4; c++) { // verifica se há alguma coluna preenchida só pelo adversário
  7. cjogada = 0;
  8. for (int l = 0; l < 7; l = l + 3) {
  9. if (Lista[l + c] == 2) {
  10. cjogada = 0;
  11. break;
  12.  
  13. }
  14. if (Lista[l + c] == 1) {
  15. cjogada = c;
  16.  
  17. }
  18.  
  19. }
  20. if (cjogada == c) {
  21. break;
  22. }
  23. }
  24. for (int l = 0; l < 7; l = l + 3) { //verifica se ganha em linha
  25. ljogada = 0;
  26. for (int c = 1; c < 4; c++) {
  27. if (Lista[l + c] == 2) {
  28. ljogada = 0;
  29. break;
  30. }
  31. if (Lista[l + c] == 1) {
  32. ljogada = l / 3 + 1;
  33. }
  34.  
  35. }
  36.  
  37. if (ljogada == l / 3 + 1) {
  38. break;
  39. }
  40. }
  41. if (ljogada != 0 && cjogada != 0 && Lista[ljogada * 3 - 3 + cjogada] == 0) {
  42.  
  43. jogada = ljogada * 3 - 3 + cjogada;
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement