[DicePoker]

Dice Poker

Scoring:
3 of a kind: 2 points
4 of a kind: 4 points
5 of a kind: 10 points
Full House (3 + 2 of a kind): 3 points
Low Straight (1,2,3,4,5): 5 points
High Straight (2,3,4,5,6): 6 points

 Click ROLL to start

Score: 

Würfelpoker

[Kompatibilität]

[zwischen <HEAD> und </HEAD>]

<style>
.n2{
**dice color;
background-color: red;
**dot color;
color: black;
border: 0pt solid;
font-size: 15pt;
}
.n1{
backgroud-color: black;
color: black;
border: 0pt solid;
}
</style>

<script language="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
char1="&nbsp;"
char2=unescape("%u2022")
numbers=new Array();
times=1;
function roll(a,b,c,d,e){
toroll=new Array(a,b,c,d,e);
towrite=""
towrite+='<form name="dgame"><table cellpadding=\"30\" class=\"n1\"><tr>';
for(j=0;j<5;j++){
if((j!=0)&&(j/5==Math.floor(j/5))){ towrite+="</tr><tr>" }
if((!toroll[j])&&(times==2)){
number=numbers[j];
}
else if((toroll[j])||(times==1)){
number=Math.floor(Math.random()*10 % 6)
number++;
}
towrite+="<td>";
switch(number){
// char1 = space; char2 = dot
case 1: holes=new Array(char1,char1,char1,char1,char2,char1,char1,char1,char1); break;
case 2: holes=new Array(char2,char1,char1,char1,char1,char1,char1,char1,char2); break;
case 3: holes=new Array(char2,char1,char1,char1,char2,char1,char1,char1,char2); break;
case 4: holes=new Array(char2,char1,char2,char1,char1,char1,char2,char1,char2); break;
case 5: holes=new Array(char2,char1,char2,char1,char2,char1,char2,char1,char2); break;
case 6: holes=new Array(char2,char1,char2,char2,char1,char2,char2,char1,char2); break;
case 7: holes=new Array(char2,char1,char1,char1,char1,char1,char1,char1,char1); break;
}
towrite+='<table class="n2" border="0" cellpadding="0" cellspacing="0"><tr>';
for(i=0;i<3;i++){
towrite+='<td>&nbsp;'+holes[i]+'&nbsp;</td>\n'
}
towrite+='</tr><tr>';
for(i=3;i<6;i++){
towrite+='<td>&nbsp;'+holes[i]+'&nbsp;</td>\n'
}
towrite+='</tr><tr>';
for(i=6;i<9;i++){
towrite+='<td>&nbsp;'+holes[i]+'&nbsp;</td>\n'
}
towrite+='</tr></table>'
if(times==1){
towrite+='<input type="checkbox" name="hold'+j+'"> Hold';
}
else{
if(!toroll[j]){ towrite+='Held' }
else if(toroll[j]){ towrite+='&nbsp;' }
}
numbers[j]=number;
towrite+='</td>'
}
if(times==1){ times++; }
else{ times--; }
if(dice>1) towrite+='</tr></table></form>';
document.all.dice.innerHTML=towrite;
return numbers;
}
function clickbutton(){
points=0;
win="nothing";
alpha=new Array("a","b","c","d","e");
types=new Array("ones","twos","threes","fours","fives","sixes");
if(times==1){
x=roll(1,1,1,1,1)
}
else{
a=(document.dgame.hold0.checked)?0:1
b=(document.dgame.hold1.checked)?0:1
c=(document.dgame.hold2.checked)?0:1
d=(document.dgame.hold3.checked)?0:1
e=(document.dgame.hold4.checked)?0:1
x=roll(a,b,c,d,e);
ones=0
twos=0
threes=0
fours=0
fives=0
sixes=0
//win checker
//counts how many of each number there is
for(k=0;k<5;k++){
 if(x[k]==1) ones++;
 if(x[k]==2) twos++;
 if(x[k]==3) threes++;
 if(x[k]==4) fours++;
 if(x[k]==5) fives++;
 if(x[k]==6) sixes++;
}
//alert(eval(types[0])+" ones\n"+eval(types[1])+" twos\n"+eval(types[2])+" threes\n"+eval(types[3])+" fours\n"+eval(types[4])+" fives\n"+eval(types[5])+" sixes\n");
for(l=0;l<6;l++){
 if(eval(types[l])==3){
 points=1; win="Three of a kind";
 for(m=0;m<6;m++){

if((eval(types[m])==2)&&(m!=l)){

points=3; win="Full House (3 + 2 of a kind)";

}
 }
}
if(eval(types[l])==4){ points=4; win="Four of a kind"; }
if(eval(types[l])==5){ points=10; win="Five of a kind"; }
//checks for one of every number except 6
if((eval(types[0])==1)&&(eval(types[1])==1)&&(eval(types[2])==1)&&(eval(types[3])==1)&&(eval(types[4])==1)){
win="Low Straight"; points="5"
}
//checks for one of every number except 1
if((eval(types[1])==1)&&(eval(types[2])==1)&&(eval(types[3])==1)&&(eval(types[4])==1)&&(eval(types[5])==1)){
win="High Straight"; points="6"
}
}
alert("You got "+win+"!\n\nThat's "+points+" points!");
total=parseInt(document.score.total.value);
total+=parseInt(points);
document.score.total.value=total;
}
}
//  End -->
</script>

[zwischen <BODY> und </BODY>]

<center><b>Dice Poker</b></center>
<input type="button" value="Roll" onClick="clickbutton();"><p>
<span id="dice">Scoring:<br>
3 of a kind: 2 points<br>
4 of a kind: 4 points<br>
5 of a kind: 10 points<br>
Full House (3 + 2 of a kind): 3 points<br>
Low Straight (1,2,3,4,5): 5 points<br>
High Straight (2,3,4,5,6): 6 points<p>
Click ROLL to start</span><br>
<form name="score">Score: <input type="text" size="3" name="total" onFocus="this.blur()" value="0">
</form>

[Autor]

??

[Download]

Kopieren Sie bitte den Code

Copyright © 1998- Nightfire Webworker Archiv Script No: 0113