Kaydet (Commit) bba49db7 authored tarafından Muaz's avatar Muaz

Oyun kuralları olusturuldu

Oyunun isleyisini iceren 4 kuralin kontrolleri yapildi.
üst 7d45d4da
......@@ -27,17 +27,21 @@ function tikla(id){
if(Number(id[4])==1 && player==Number(id[4])){
console.log(user1hole[Number(id[9])-1].id);
dagit(Number(id[4]),Number(id[9]));
player=2;
dagit(Number(id[4]),Number(id[9]));
}else if(Number(id[4])==2 && player==Number(id[4])){
console.log(id[4]);
dagit(Number(id[4]),Number(id[9]));
player=1;
dagit(Number(id[4]),Number(id[9]));
}
boncukCiz();
console.log(user1hole);
console.log(user2hole);
......@@ -68,6 +72,31 @@ function dagit(user,hole){
}else if(sira==-1){
user2hole[holeID].value+=1;
}
if(i == count - 1){
sonHole = holeID;
if(sonHole == 6){
player = 1;
}else if( sira == -1 && user2hole[sonHole].value % 2 == 0){
user1hole[6].value += user2hole[sonHole].value;
user2hole[sonHole].value = 0;
}else if(user1hole[sonHole].value == 1 && user2hole[6 - sonHole].value > 0){
user1hole[6].value += user2hole[6 - sonHole].value + 1;
user1hole[sonHole].value = 0;
user2hole[6 - sonHole].value = 0;
}
}
let total = 0;
for(let o = 0; o < 6; o++){
total += user1hole[o];
}
if(total == 0){
tabladakiBoncuklar = 0;
for (let k = 0; k < 6; k++){
tabladakiBoncuklar += user2hole[k];
user2hole[k].value=0;
}
user1hole[6].value += tabladakiBoncuklar;
}
holeID+=1;
i++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment