Advertisement
Guest User

sss

a guest
Oct 16th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. function deffenseHorizontalAI(){
  2. //ova funkcija moze da se brani levo ili desno po vertikali
  3. var crvene = 0;
  4.  
  5. for (let row = 0; row < 6; row++) {
  6.  
  7. for (let col = 0; col < 6; col++) {
  8.  
  9. if($(`div[data-row='${row}'][data-col='${col}']`).hasClass("red") ){
  10. crvene++;
  11. if(crvene>=3){
  12. if($(`div[data-row='${row}'][data-col='${col+1}']`).hasClass("empty") ){
  13. return col+1;
  14. }
  15. if($(`div[data-row='${row}'][data-col='${col-3}']`).hasClass("empty") ){
  16. return col-3;
  17. }
  18. }
  19. }
  20. }
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement