Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function deffenseHorizontalAI(){
- //ova funkcija moze da se brani levo ili desno po vertikali
- var crvene = 0;
- for (let row = 0; row < 6; row++) {
- for (let col = 0; col < 6; col++) {
- if($(`div[data-row='${row}'][data-col='${col}']`).hasClass("red") ){
- crvene++;
- if(crvene>=3){
- if($(`div[data-row='${row}'][data-col='${col+1}']`).hasClass("empty") ){
- return col+1;
- }
- if($(`div[data-row='${row}'][data-col='${col-3}']`).hasClass("empty") ){
- return col-3;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement