½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
happycgi
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > JAVASCRIPT > javascript ¼Ò½ºÃ¢°í > °ÔÀÓ > Æ÷Ä¿°ÔÀÓ »ó¼¼Á¤º¸
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
Javascript
PHP
asp
CSS
html
mysql
jquery
image
Mobile
API
slide
°Ô½ÃÆÇ
¸Þ´º
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
Æ÷Ä¿°ÔÀÓ
¼Ò½ºÅë°èÁ¤º¸ ¿À·ù½Å°í ¹× ¹®ÀÇ
ÇØÇÇÆÀ
³×ƼÁð
Æ®À§ÅÍ·Î º¸³»±â ÆäÀ̽ººÏÀ¸·Î º¸³»±â
¼Ò½ººÐ·ù °ÔÀÓ
´Ù¿î·Îµå Ƚ¼ö 1231 ȸ
°£´Ü¼³¸í °£´ÜÇÏ°Ô Áñ±æ ¼ö ÀÖ´Â Æ÷Ä¿°ÔÀÓÀÔ´Ï´Ù.
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
ȨÆäÀÌÁö¹Ù·Î°¡±â ¼Ò½º´Ù¿î·Îµå µ¥¸ð ¹Ì¸®º¸±â ½ºÅ©·¦Çϱâ

<html>
<head>
    <title>ÇØÇÇCGI</title>

<body>

<center>
<form name=Form>
<table border=0 cellpadding=0 cellspacing=2 bgcolor=blue><tr><td>
<table border=0 cellpadding=5 cellspacing=0 bgcolor=#c0c0c0>
<tr>
<td rowspan=2 bgcolor=blue valign=top><font face=Tahoma color=white size=4>D<BR>E<BR>A<BR>L<BR>E<BR>R</font></TD>
<td valign=top><img src=casino_img/done.gif name=Deal0 width=70 height=96></td>
<td valign=top><img src=casino_img/done.gif name=Deal1 width=70 height=96></td>
<td valign=top><img src=casino_img/done.gif name=Deal2 width=70 height=96></td>
<td valign=top><img src=casino_img/done.gif name=Deal3 width=70 height=96></td>
<td valign=top><img src=casino_img/done.gif name=Deal4 width=70 height=96></td>

</tr>
<tr>
<td colspan=5 bgcolor=blue align=center>
<input type=button value="DEAL" name="Button" style="width:250" width=250 onclick="Deal(this.value)">
</td>
<td rowspan=2 bgcolor=blue VALIGN=bottom><font face=Tahoma color=white size=4>P<BR>L<BR>A<BR>Y<BR>E<BR>R</font></TD>
</tr>

<tr>
<td></td>
<td valign=bottom><a href='javascript:Change(0)'><img src=casino_img/done.gif name=Card0 width=70 height=96 border=0></a></td>
<td valign=bottom><a href='javascript:Change(1)'><img src=casino_img/done.gif name=Card1 width=70 height=96 border=0></a></td>
<td valign=bottom><a href='javascript:Change(2)'><img src=casino_img/done.gif name=Card2 width=70 height=96 border=0></a></td>
<td valign=bottom><a href='javascript:Change(3)'><img src=casino_img/done.gif name=Card3 width=70 height=96 border=0></a></td>
<td valign=bottom><a href='javascript:Change(4)'><img src=casino_img/done.gif name=Card4 width=70 height=96 border=0></a></td>
</tr>
<input type=hidden name=Change0 value=0>
<input type=hidden name=Change1 value=0>
<input type=hidden name=Change2 value=0>
<input type=hidden name=Change3 value=0>
<input type=hidden name=Change4 value=0>
<tr>
<td>
<td colspan=5 align=center>
<textarea name=PlayerHand cols=30 rows=3 wrap=yes value="Click DEAL to play new round"></textarea>
<td>
</tr>
</td></tr>
<tr>
<td></td>
<td align=center><input type=button style="width:70" width=70 value=$50 onclick="BetAdd(50)"></td>
<td align=center><input type=button style="width:70" width=70 value=$100 onclick="BetAdd(100)"></td>
<td align=center><input type=button style="width:70" width=70 value=$200 onclick="BetAdd(200)"></td>
<td align=center><input type=button style="width:70" width=70  value=$500 onclick="BetAdd(500)"></td>
<td align=center><input type=button style="width:70" width=70  value=$1000 onclick="BetAdd(1000)"></td>
</tr></table>
</td></tr></table>
</form>
</center>
</body>

<script>
var imgpath="casino_img/";

Sum=10000
Deck=new Array()
Pairs=new Array()
CardNames=new Array()
Suites=new Array("s","h","c","d")
Count=new Array()
Player=new Array()
Dealer=new Array()
Causes=new Array(
    "Four of a kind","Flush","Straight","Full House",
    "Three of a kind","More pairs","Higher pair",
    "Higher cards","Higher cards","Higher cards","Higher cards","Higher cards"
)


function Init(){
    Bet=50
    Sum=Sum-50
    i=0
    for(s=0;s<4;s++){
    for(x=2;x<15;x++){
        Pairs[x]=0
        CardNames[i]=Suites[s]+x
        Deck[i]=0
        i++
        }
    }

    for(x=0;x<5;x++){
        document["Deal"+x].src=imgpath+"blnk.gif"
        document["Card"+x].src=imgpath+"blnk.gif"
        document.Form["Change"+x].value=0
    }
    InDeck=52
    document.Form.Button.value="DEAL"
    document.Form.PlayerHand.value="Minimum Bet : $50\nClick DEAL to start round.\nMoney : $"+Sum
}

 

function Pick(){
InDeck--
if(InDeck<1){
alert("No more cards!")
return
}
ran=Math.floor(Math.random()*52)
while(Deck[ran]==1){
ran=Math.floor(Math.random()*52)
}
Deck[ran]=1
return ran
}


function Change(crd){
if(document.Form.Button.value!="CHANGE") return
else{
document["Card"+crd].src=imgpath+'blnk.gif'
document.Form["Change"+crd].value=1
}
}

function BetAdd(Amt){
if(document.Form.Button.value!="OKAY") return
if(Sum<Amt){
document.Form.PlayerHand.value="Not enough money!\nChoose another amount\or click OKAY now"
return
}
Bet+=Amt
Sum=Sum-Amt
document.Form.PlayerHand.value="Bet : $"+Bet+"\nMoney : $"+Sum+"\nClick OKAY when ready"
}

function Deal(com){

if(com=="DEAL"){
for(x=0;x<5;x++){
Player[x]=CardNames[Pick()]
document["Card"+x].src=imgpath+Player[x]+".gif"
Dealer[x]=CardNames[Pick()]
document["Deal"+x].src=imgpath+"done.gif"
document.Form.Button.value="CHANGE"
document.Form.PlayerHand.value="Select unwanted cards then click CHANGE"
}
}

if(com=="CHANGE"){
for(x=0;x<5;x++){
if(document.Form["Change"+x].value==1){
Player[x]=CardNames[Pick()]
document["Card"+x].src=imgpath+Player[x]+".gif"
document.Form["Change"+x].value=0
}
document.Form.PlayerHand.value="Minimum Bet : $50\nClick buttons to increase bet\nThen click OKAY"
document.Form.Button.value="OKAY"
}
}


if(com=="OKAY"){

for(x=0;x<5;x++){
document["Deal"+x].src=imgpath+Dealer[x]+".gif"
}

DealScore=SortHand(Dealer)
PlayScore=SortHand(Player)
document.Form.Button.value="NEW ROUND"
sc=0
while(PlayScore[sc]==DealScore[sc])sc++

 

if(PlayScore[sc]>DealScore[sc]){
Final="You won $"+Bet+"\n(You have "
Sum=Sum+Bet*2
}
else{
Final="You lost $"+Bet+"\n(Dealer has "
}
document.Form.PlayerHand.value=Final+Causes[sc]+" )\nMoney : $"+Sum
if(Sum<100||Sum>100000) GameOver()
}

if(com=="NEW ROUND") Init()

}

function Order(num1,num2){
if(parseInt(num1)<parseInt(num2)) return 1
if(parseInt(num1)>parseInt(num2)) return -1
if(parseInt(num1)==parseInt(num2)) return 0
}

Hand=new Array("Player","Dealer")
h=0


function SortHand(Arr){
h=(h==1)?0:1

Flush=0
CntF=0
for(x=1;x<5;x++){
if(Arr[0].charAt(0)==Arr[x].charAt(0))CntF++
}
if(CntF>3){
Flush=parseInt(Arr[4].substring(1,Arr[4].length))
}


A=Arr
for(x=0;x<5;x++){
A[x]=parseInt(Arr[x].substring(1,Arr[x].length))
}
A=A.sort(Order)


for(y=0;y<52;y++){
Count[y]=0
for(x=0;x<5;x++){
if(A[x]==y) Count[y]++
}
}

Pair=0
Tripl=0
FullHouse=0
Quad=0
HavePair=0
Straight=0
TopPair=0

for(y=0;y<52;y++){

if(Count[y]==2){
Pair++
TopPair=y
HavePair=1
}

if(Count[y]==3){
Tripl=y
HavePair=1
}

if(Count[y]==4){
Quad=y
HavePair=1
}
}

if(Pair>0&&Tripl>0) FullHouse=Tripl

if(HavePair==0){
Gap=A[0]-A[4]
if(Gap==4){
Straight=A[0]
}
}

    Score=new Array()
    Score[0]=Quad
    Score[1]=Flush
    Score[2]=Straight
    Score[3]=FullHouse
    Score[4]=Tripl
    Score[5]=Pair
    Score[6]=TopPair
    Score[7]=Arr[0]
    Score[8]=Arr[1]
    Score[9]=Arr[2]
    Score[10]=Arr[3]
    Score[11]=Arr[4]
return Score
}


Init()

function GameOver(){
Saying=(Sum>100000)?"You are a born gambler!\nExcellent!\nSo when are you going to Las Vegas?":"You're one of the most unfortunate gamlers I ever came across!"
}
</script>

 

</HTML>


³×ƼÁð ÀÇ°ß   ÀÌ¿ëÇϽŠÀÚ·áÀÇ Èı⸦ ÀÚÀ¯·Ó°Ô ÀÛ¼ºÇϼ¼¿ä. (»ó¾÷ÀûÀÎ ±¤°í ¹× µµ¹è¼º ±Û µîÀº »çÀüÅ뺸¾øÀÌ »èÁ¦µÉ ¼ö ÀÖ½À´Ï´Ù.)
³»¿ë ¾ÆÀ̵ð ÀÇ°ß³²±â±â
µî·ÏµÈ ÀÇ°ßÀÌ ¾ø½À´Ï´Ù.
1
À̸§
³»¿ë
:³×¸Â¾Æ¿ä: :È­³ª´Â±º¿ä: :Àá¿Í: :¿ì¿ïÇØ: :À̰ǾƳÄ: :¿ÕÇÏÇÏ: ¿Õ¿ôÀ½~ ³î·¥~
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
µµ¹è¹æÁöÅ°
 31353073 º¸ÀÌ´Â µµ¹è¹æÁöÅ°¸¦ ÀÔ·ÂÇϼ¼¿ä.