psedeocode game solitaire :
for i=1 to i=7
if ai= hati
if ai= jack, then ai= H(11)
if else ai=queen, then ai=H(12)
if else ai=king, then ai=H(13)
if else ai= as, then ai=H(1)
else
for j=2 to j=10
if ai= j, then ai= H(j)
if else= wajik
if ai= jack, then ai= W(11)
if else ai=queen, then ai=W(12)
if else ai=king, then ai=W(13)
if else ai= as, then ai=W(1)
else
for j=2 to j=10
if ai= j, then ai= W(j)
if else= sekop
if ai= jack, then ai= S(11)
if else ai=queen, then ai=S(12)
if else ai=king, then ai=S(13)
if else ai= as, then ai=S(1)
else
for j=2 to j=10
if ai= j, then ai= S(j)
else
if ai= jack, then ai= K(11)
if else ai=queen, then ai=K(12)
if else ai=king, then ai=K(13)
if else ai= as, then ai=K(1)
else
for j=2 to j=10
if ai= j, then ai= K(j)
end for
H=0 ;p=0
W=0 ;e=0
S=0 ;t=0
K=0 ;o=0
while (tumpukan != 0 and H=13,W=13,S=13,K=13)
if ambil kartu > 25 and tidak ada perpindahan kartu
then while end
else
katu masih bisa berpindah
while (kartu masih bisa berpindah)
for i=1 to i=8
if ai= H(p+1), then H++; p++; {ai}--
if else ai= w(e+1), then w++; e++; {ai}--
if else ai= S(t+1), then S++; t++; {ai}--
if else ai= K(o+1), then H++; o++; {ai}--
end for
i=1; j=1
b=0 ; c=0 ;d=1
while (i<= 8 and d=1)
while (j<= 8 and d=1)
if ai= H(x) or W(x) and aj= S(x+1) or K(x+1),
then ai move to aj
d--
if else ai= S(x) or K(x) and aj= H(x+1) or W(x+1),
then ai move to aj
d--
if else ai= H(13) or W(13) or S(13) or K(13) and aj=0 and j!=8
then ai move to aj
d--
end while
end while
end while
do (ambil kartu di tumpukan)
kartu baru = a8
if a8= hati
if a8= jack, then ai= H(11)
if else a8=queen, then a8=H(12)
if else a8=king, then a8=H(13)
else
for j=2 to j=10
if a8= j, then a8= H(j)
if else= wajik
if a8= jack, then a8= W(11)
if else a8=queen, then a8=W(12)
if else a8=king, then a8=W(13)
else
for j=2 to j=10
if a8= j, then a8= W(j)
if else= sekop
if a8= jack, then a8= S(11)
if else a8=queen, then a8=S(12)
if else a8=king, then a8=S(13)
else
for j=2 to j=10
if a8= j, then a8= S(j)
else
if a8= jack, then a8= K(11)
if else a8=queen, then a8=K(12)
if else a8=king, then a8=K(13)
else
for j=2 to j=10
if a8= j, then a8= K(j)
end while
Game ended.
if H=13, W=13, S=13, and K=13
you win the game
else
you lose
0 komentar:
Posting Komentar