Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
M
mangala-pardusacikhack
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Tuğba Fıçıcı
mangala-pardusacikhack
Commits
e5135122
Kaydet (Commit)
e5135122
authored
May 06, 2021
tarafından
Muaz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Zorluk seviyeleri ayarlandi, hamleler arasi bekleme eklendi
üst
89e8826f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
33 deletions
+106
-33
robotGameArea.js
pages/robotGameArea.js
+106
-33
No files found.
pages/robotGameArea.js
Dosyayı görüntüle @
e5135122
...
@@ -28,14 +28,20 @@ class Hole {
...
@@ -28,14 +28,20 @@ class Hole {
}
}
}
}
var
robotMedium
=
0
;
var
state
=
true
;
//true ise oyun devam ediyor.
var
state
=
true
;
//true ise oyun devam ediyor.
async
function
wait
(
x
)
{
async
function
wait
(
x
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
//console.log("Done waiting");
//console.log("Done waiting");
if
(
zorlukDerecesi
==
1
||
zorlukDerecesi
==
2
){
if
(
zorlukDerecesi
==
4
){
runRobotExpert
();
}
else
if
(
zorlukDerecesi
==
3
){
runRobotHard
();
}
else
if
(
zorlukDerecesi
==
2
){
robotMedium
();
}
else
{
robotEasy
();
robotEasy
();
}
}
...
@@ -61,7 +67,10 @@ var treasure2=new Hole(0,"user2hole7");
...
@@ -61,7 +67,10 @@ var treasure2=new Hole(0,"user2hole7");
user1hole
.
push
(
treasure1
);
user1hole
.
push
(
treasure1
);
user2hole
.
push
(
treasure2
);
user2hole
.
push
(
treasure2
);
var
player
=
2
;
var
player
=
2
;
/*
while(player == 1 && state){
runRobotExpert();
}*/
function
tikla
(
id
){
function
tikla
(
id
){
// ekranda bulunan kuyulardaki kuyulara tıklama ile tetiklenen fonk.
// ekranda bulunan kuyulardaki kuyulara tıklama ile tetiklenen fonk.
// tiklanan kuyunun html' deki id sini alır
// tiklanan kuyunun html' deki id sini alır
...
@@ -71,40 +80,20 @@ function tikla(id){
...
@@ -71,40 +80,20 @@ function tikla(id){
if
(
Number
(
id
[
4
])
==
1
&&
player
==
Number
(
id
[
4
])
&&
id
[
10
]
==
"x"
){
//bilgisayar tikladiysa x gelecek
if
(
Number
(
id
[
4
])
==
1
&&
player
==
Number
(
id
[
4
])
&&
id
[
10
]
==
"x"
){
//bilgisayar tikladiysa x gelecek
if
(
user1hole
[
Number
(
id
[
9
])
-
1
].
value
!=
0
){
if
(
user1hole
[
Number
(
id
[
9
])
-
1
].
value
!=
0
){
//player=2;
dagit
(
Number
(
id
[
4
]),
Number
(
id
[
9
]));
dagit
(
Number
(
id
[
4
]),
Number
(
id
[
9
]));
boncukCiz
();
boncukCiz
();
}
}
}
else
if
(
Number
(
id
[
4
])
==
2
&&
player
==
Number
(
id
[
4
])){
//kullanici tikladiginda
}
else
if
(
Number
(
id
[
4
])
==
2
&&
player
==
Number
(
id
[
4
])){
//kullanici tikladiginda
if
(
user2hole
[
Number
(
id
[
9
])
-
1
].
value
!=
0
){
if
(
user2hole
[
Number
(
id
[
9
])
-
1
].
value
!=
0
){
//player=1; //bu burada kalmali
dagit
(
Number
(
id
[
4
]),
Number
(
id
[
9
]));
dagit
(
Number
(
id
[
4
]),
Number
(
id
[
9
]));
boncukCiz
();
boncukCiz
();
if
(
zorlukDerecesi
==
4
){
if
(
player
==
1
&&
state
){
while
(
player
==
1
&&
state
){
wait
(
3000
);
runRobotExpert
();
}
}
else
if
(
zorlukDerecesi
==
3
){
while
(
player
==
1
&&
state
){
robotHard
();
}
}
else
if
(
zorlukDerecesi
==
2
&&
robotMedium
%
3
==
1
){
robotMedium
+=
1
;
while
(
player
==
1
&&
state
){
robotHard
();
}
}
else
{
robotMedium
+=
1
;
if
(
player
==
1
&&
state
){
wait
(
2000
);
}
}
}
}
}
}
}
...
@@ -166,12 +155,14 @@ function dagit(user,hole){
...
@@ -166,12 +155,14 @@ function dagit(user,hole){
}
}
}
else
if
(
sira
==
-
1
&&
user2hole
[
sonHole
].
value
%
2
==
0
){
// son tas karsi tarafin kuyusunu cift yapiyorsa hepsini al
}
else
if
(
sira
==
-
1
&&
user2hole
[
sonHole
].
value
%
2
==
0
){
// son tas karsi tarafin kuyusunu cift yapiyorsa hepsini al
//console.log(sonHole,".....sonhole");
//console.log(sira,".....sira");
player
=
2
;
player
=
2
;
user1hole
[
6
].
value
+=
user2hole
[
sonHole
].
value
;
user1hole
[
6
].
value
+=
user2hole
[
sonHole
].
value
;
user1hole
[
6
].
addedDotcount
+=
user2hole
[
sonHole
].
value
;
user1hole
[
6
].
addedDotcount
+=
user2hole
[
sonHole
].
value
;
user2hole
[
sonHole
].
value
=
0
;
user2hole
[
sonHole
].
value
=
0
;
user2hole
[
sonHole
].
addedDotcount
=
0
;
user2hole
[
sonHole
].
addedDotcount
=
0
;
}
else
if
(
user1hole
[
sonHole
].
value
==
1
&&
user2hole
[
5
-
sonHole
].
value
>
0
){
// son tas kendindenki bos kuyuna geliyosa,
}
else
if
(
sira
==
1
&&
user1hole
[
sonHole
].
value
==
1
&&
user2hole
[
5
-
sonHole
].
value
>
0
){
// son tas kendindenki bos kuyuna geliyosa,
player
=
2
;
player
=
2
;
// ve karsi kuyu da tas varsa kendi tek tasini ve karsidakileri hepsini al
// ve karsi kuyu da tas varsa kendi tek tasini ve karsidakileri hepsini al
//console.log(user2hole[5 - sonHole].value + " kural 3 gerceklesti.");
//console.log(user2hole[5 - sonHole].value + " kural 3 gerceklesti.");
...
@@ -345,7 +336,7 @@ function robotEasy(){
...
@@ -345,7 +336,7 @@ function robotEasy(){
tikla
(
"user1hole"
+
(
array
[
holeID
]
+
1
).
toString
()
+
"x"
);
tikla
(
"user1hole"
+
(
array
[
holeID
]
+
1
).
toString
()
+
"x"
);
}
}
}
}
function
robot
Hard
(){
function
robot
Medium
(){
//console.log("HHHHARD calisti.");
//console.log("HHHHARD calisti.");
let
array
=
doluHoleler
();
let
array
=
doluHoleler
();
let
len
=
array
.
length
;
let
len
=
array
.
length
;
...
@@ -413,10 +404,93 @@ function robotHard(){
...
@@ -413,10 +404,93 @@ function robotHard(){
}
}
}
}
////////////////////////////////////
function
runRobotHard
(){
let
move
=
robotHard
()
player
=
1
;
//console.log("en yuksek insdis########### ",array[max_indis], ", tiklaniyor.");
tikla
(
"user1hole"
+
(
move
).
toString
()
+
"x"
);
}
function
robotHard
(){
//console.log("HHHHARD calisti.");
let
array
=
doluHoleler
();
let
len
=
array
.
length
;
let
score_ar
=
[];
// dolu hucrelerle ayni indisle
if
(
len
>
0
){
var
temp1
=
[];
var
temp2
=
[];
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
temp1
.
push
(
new
Hole
(
user1hole
[
i
].
getValue
(),
user1hole
[
i
].
getID
()));
temp2
.
push
(
new
Hole
(
user2hole
[
i
].
getValue
(),
user2hole
[
i
].
getID
()));
};
bosalt
();
//console.log("ilk bosalt sonrasi user1hoel uzunnlugu: ",user1hole.length);
//console.log("ilk bosalt sonrasi user2hole uzunnlugu: ",user2hole.length);
/*
console.log("robotHard hesaplama basliyor..");
console.log("temp1[0].value: ", temp1[0].value);
console.log("user1hole[0].value: ", user1hole[0].value);
console.log("atamar yapiliyor..");
temp1[0].value = 100;
user1hole[0].value = 999;
console.log("temp1[0].value: ", temp1[0].getValue());
console.log("user1hole[0].value: ", user1hole[0].getValue());
player = 2;
*/
for
(
let
k
=
0
;
k
<
array
.
length
;
k
++
){
// dolu hocre sayisi kadar don
let
denenecek_hole_indis
=
array
[
k
];
// dolu hucresinin indisini al
//console.log("hole ,",denenecek_hole_indis, ", deneniyor.");
bosalt
();
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
user1hole
.
push
(
new
Hole
(
temp1
[
i
].
getValue
(),
temp1
[
i
].
getID
()));
user2hole
.
push
(
new
Hole
(
temp2
[
i
].
getValue
(),
temp2
[
i
].
getID
()));
};
//console.log("dagitim sonrasi user1hole uzunnlugu: ",user1hole.length);
//console.log("dagitim öncesi hazine: ",user1hole[6].value);
//tikla("user1hole"+(denenecek_hole_indis+1).toString()+"x"); // dolu hucreyi dagittini dusun
dagit
(
1
,
denenecek_hole_indis
+
1
);
//console.log("dagitim sonrasi hazine: ",user1hole[6].value);
// dolu hucre dagilitdiktan sonra hazinenin degerini al ve score ar.ine ata
while
(
player
==
1
){
let
move
=
robotExpert
();
dagit
(
1
,
move
);
}
score_ar
[
k
]
=
user1hole
[
6
].
getValue
();
}
// her dolu kutu denendikten sonra hazineyi encok arttıran adimi sec
bosalt
();
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
user1hole
.
push
(
new
Hole
(
temp1
[
i
].
getValue
(),
temp1
[
i
].
getID
()));
user2hole
.
push
(
new
Hole
(
temp2
[
i
].
getValue
(),
temp2
[
i
].
getID
()));
};
let
max
=
0
;
let
max_indis
=
0
;
for
(
let
a
=
0
;
a
<
score_ar
.
length
;
a
++
){
// en yuksek hazine degerini bul
if
(
score_ar
[
a
]
>=
max
){
max
=
score_ar
[
a
];
max_indis
=
a
;
}
}
//player = 1;
//console.log("en yuksek insdis########### ",array[max_indis], ", tiklaniyor.");
//tikla("user1hole"+(array[max_indis]+1).toString()+"x");
return
array
[
max_indis
]
+
1
;
}
}
////////////////////////////////////
function
runRobotExpert
(){
function
runRobotExpert
(){
let
move
=
robotExpert
()
let
move
=
robotExpert
()
player
=
1
;
player
=
1
;
//console.log("en yuksek insdis########### ",
array[max_indis]
, ", tiklaniyor.");
//console.log("en yuksek insdis########### ",
move
, ", tiklaniyor.");
tikla
(
"user1hole"
+
(
move
).
toString
()
+
"x"
);
tikla
(
"user1hole"
+
(
move
).
toString
()
+
"x"
);
}
}
function
robotExpert
(){
function
robotExpert
(){
...
@@ -617,5 +691,4 @@ function overlay() {
...
@@ -617,5 +691,4 @@ function overlay() {
function
overlayOff
()
{
function
overlayOff
()
{
document
.
getElementById
(
"overlay"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"overlay"
).
style
.
display
=
"none"
;
}
}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment