Programalama > JAVA SCRIPT

Etiketler: blackjack

Ort. 0
Puan ver:
<html>


<head>
<title>z-blackjack</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Mike McGrath (mike_mcgrath@lineone.net) -->

<!-- Begin
var gameOver; var cardCount;
function Shuffle(max){
var num=Math.random()*max;
return Math.round(num)+1;
}
function getSuit(){
suit = Shuffle(4);
if(suit == 1) return "Maça";
if(suit == 2) return "Sinek";
if(suit == 3) return "Karo";
else return "Kupa";
}
function cardName(card){
if(card == 1) return "As";
if(card == 11) return "Vale";
if(card == 12) return "Kız";
if(card == 13) return "Kral";
return "" + card;
}
function cardValue(card,strWho){
if(card == 1) {
	if(strWho =="You" && document.display.you.value >10){
	document.display.say2.value=document.display.say2.value+" Low"; return 1;}
	else return 11; }
 if(card > 10) return 10; 
return card;
}
function PickACard(strWho){
card = Shuffle(12);
suit = getSuit();
if(strWho =="You")
document.display.say2.value=(suit + "    " + cardName(card)); else
document.display.say1.value=(suit + "    " +cardName(card)); return cardValue(card,strWho); } function NewHand(form){ if(gameOver !=0) {form.say1.value=("Hand in Play!"); form.say2.value=(""); return;} else {form.dealer.value = 0; form.you.value = 0; cardCount=0; form.dealer.value = eval(form.dealer.value) + PickACard("Dealer"); form.you.value = eval(form.you.value) + PickACard("You"); gameOver= -1; cardCount+=1;} } function Dealer(form){ if (gameOver ==0) {form.say1.value=("Kartları Dağıt!"); form.say2.value=(""); return;} else
if(form.you.value<10)
{form.say1.value=("Not Below Ten!"); form.say2.value=("Take a Hit!"); return;} else if (cardCount <2) {form.say1.value=("En Az 2 Kart Açılmalı!"); form.say2.value=("Hit Again!"); return;} else while(form.dealer.value < 17) {form.dealer.value = eval(form.dealer.value) + PickACard("Dealer");} } function User(form){ if (gameOver ==0) {form.say1.value=("Deal the Cards!"); form.say2.value=(""); return;} else {cardCount+=1; form.say1.value=("You Get..."); form.you.value = eval(form.you.value) + PickACard("You");} if(form.you.value > 21) {form.say1.value=("You Busted!"); gameOver=0; form.numgames.value=eval(form.numgames.value)-1;}
}
function LookAtHands(form){
if (gameOver ==0 || form.you.value<10 || cardCount <2){return;} else if(form.dealer.value > 21) {form.say1.value=("House Busts!"); form.say2.value=("Kazandınız! $$$$$$"); gameOver=0; form.numgames.value=eval(form.numgames.value)+1;}
 else
if(form.you.value > form.dealer.value)
{form.say1.value=("You Win!"); form.say2.value=("$$$$$$$$$$$$$$$");
gameOver=0; form.numgames.value=eval(form.numgames.value)+1;}
 else
 if(form.dealer.value == form.you.value) {form.say1.value=("Berabere!"); form.say2.value=("Tekrar Oyna!"); gameOver=0; form.numgames.value=eval(form.numgames.value)-1;}
 else
{form.say1.value=("Kasa Kazandı!"); form.say2.value=("Geçmiş Olsun!"); gameOver=0; form.numgames.value=eval(form.numgames.value)-1;}
}
function setBj(){
gameOver=0; cardCount=0; 
document.display.dealer.value=""; 
document.display.you.value=""; document.display.numgames.value="0";
document.display.say1.value="    Kağıtları Dağıt";
document.display.say2.value="    Başla!";
}
// End -->
</script>



</head>

<BODY OnLoad="setBj()">

<center>
<form name="display">
<table bgcolor="#c0c0c0" border="1" cellspacing="0" cellpadding="3"> <tr> <td><center>Scor:</center></td> <td><center>
  Kasa</center></td> <td><center><input type=text name="dealer" size="2"></center></td>
<td><center>Kartlar:  <input type=text name="say1" size="18" value=""></center></td> </tr> <tr> <td><center><input type=text name="numgames" size="3" value="0"></center></td> <td><center>Player</center></td> <td><center><input type=text name="you" size="2"></center></td>
<td><center>Kartlar:  <input type=text name="say2" size="18" value=""></center></td> </tr> <tr> <td><center>
    <input type=button value="Dağıt" onClick="NewHand(this.form)"></center></td>
<td colspan=3><center>
<input type=button value="Kağıtları Aç" onClick="Dealer(this.form);LookAtHands(this.form);">
<input type=button value="Kağıt Al" onClick="User(this.form)"></center></td></tr>
</table>
</form>
</center>

</body>

</html>


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.