listscript fcgi id=94













Mahjongg[skrypty]
Znana gra Chińska


DHTML Mah Jongg! v1.01 (c) by Sascha Noormann. All rights reserved.




please wait...




















<body background="scripts/mahjongg/bk.jpg"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<center><strong><big>DHTML Mah Jongg! v1.01 (c) by Sascha Noormann. All rights reserved.</big></strong></center>

<DIV ID='L200' style='position:absolute; width:1; height:1; z-index:10; top: -1000; left: -1000; visibility:hide; visibility:hidden;'>
<table border="6" cellpadding="8" cellspacing="0" width="400" height="150"
bordercolorlight="#FFFF80" bordercolordark="#FFFF80" bgcolor="#000080">
<tr>
<td width="100%"><p align="center"><font color="#FFFF00"><big><big><big>please wait...</big></big></big></font></td>
</tr>
</table>
</DIV>
<script language="JavaScript">
<!--//

// Variablen
var steinemax=144;
var steinedata = new Array(5);
for (n=0;n<5;n++) steinedata[n] = new Array(steinemax);
var imagesmax=42
var imagesdata = new Array(imagesmax);
for (n=0;n<imagesmax;n++) imagesdata[n] = new Image();
var steineinit = 0;
var steineebene = 0;
var clickdata = 0;
var clickflag = false;
var gamescore = steinemax;
var gametime = 15*60*1000;
var gameplay = false;
var gameclick = 0;

// Daten initialisieren
function InitData(){
function dp(x,y) {
if ((x<0) && (y<0)) { steineebene++; } else {
steinedata[0][steineinit]=x;
steinedata[1][steineinit]=y;
steinedata[2][steineinit]=steineebene;
steinedata[3][steineinit]=0; // stoneart
steinedata[4][steineinit]=0; // playdata
steineinit++;
} }
steineinit = 0;
steineebene = 0;
dp(-1,-1);
dp( 3, 1); dp( 5, 1); dp( 7, 1); dp( 9, 1); dp(11, 1); dp(13, 1);
dp(15, 1); dp(17, 1); dp(19, 1); dp(21, 1); dp(23, 1); dp(25, 1);
dp( 7, 3); dp( 9, 3); dp(11, 3); dp(13, 3); dp(15, 3); dp(17, 3);
dp(19, 3); dp(21, 3); dp( 5, 5); dp( 7, 5); dp( 9, 5); dp(11, 5);
dp(13, 5); dp(15, 5); dp(17, 5); dp(19, 5); dp(21, 5); dp(23, 5);
dp( 1, 8); dp( 3, 7); dp( 5, 7); dp( 7, 7); dp( 9, 7); dp(11, 7);
dp(13, 7); dp(15, 7); dp(17, 7); dp(19, 7); dp(21, 7); dp(23, 7);
dp(25, 7); dp( 3, 9); dp( 5, 9); dp( 7, 9); dp( 9, 9); dp(11, 9);
dp(13, 9); dp(15, 9); dp(17, 9); dp(19, 9); dp(21, 9); dp(23, 9);
dp(25, 9); dp(27, 8); dp(29, 8); dp( 5,11); dp( 7,11); dp( 9,11);
dp(11,11); dp(13,11); dp(15,11); dp(17,11); dp(19,11); dp(21,11);
dp(23,11); dp( 7,13); dp( 9,13); dp(11,13); dp(13,13); dp(15,13);
dp(17,13); dp(19,13); dp(21,13); dp( 3,15); dp( 5,15); dp( 7,15);
dp( 9,15); dp(11,15); dp(13,15); dp(15,15); dp(17,15); dp(19,15);
dp(21,15); dp(23,15); dp(25,15);
dp(-1,-1);
dp( 9, 3); dp(11, 3); dp(13, 3); dp(15, 3); dp(17, 3); dp(19, 3);
dp( 9, 5); dp(11, 5); dp(13, 5); dp(15, 5); dp(17, 5); dp(19, 5);
dp( 9, 7); dp(11, 7); dp(13, 7); dp(15, 7); dp(17, 7); dp(19, 7);
dp( 9, 9); dp(11, 9); dp(13, 9); dp(15, 9); dp(17, 9); dp(19, 9);
dp( 9,11); dp(11,11); dp(13,11); dp(15,11); dp(17,11); dp(19,11);
dp( 9,13); dp(11,13); dp(13,13); dp(15,13); dp(17,13); dp(19,13);
dp(-1,-1);
dp(11, 5); dp(13, 5); dp(15, 5); dp(17, 5); dp(11, 7); dp(13, 7);
dp(15, 7); dp(17, 7); dp(11, 9); dp(13, 9); dp(15, 9); dp(17, 9);
dp(11,11); dp(13,11); dp(15,11); dp(17,11);
dp(-1,-1);
dp(13, 7); dp(15, 7); dp(13, 9); dp(15, 9);
dp(-1,-1);
dp(14, 8);
}

// Layer erstellen
function InitLayer() {
for (n=1; n<=steinemax; n++) {
with (self.document) {
write("<DIV ID='L"+(n)+"' style='position:absolute; width:54; height:66; top:-1000; left:-1000'>");
write("<table border='0' width='54' height='66' cellspacing='0' background='../scripts/mahjongg/0.gif'><tr><td width='100%'>");
writeln("<a onclick='javascript:clk("+(n)+")'><img id='img"+(n)+"' src='#none' width=48 height=60 border=0></a></td></tr></table></DIV>");
} }
with (self.document) {
write("<DIV ID='L145' style='position:absolute; width:1; height:1; z-index:5; top: -1000; left: -1000; visibility:hide; visibility:hidden;'>");
write("<table border='2' width='48' height='60' bordercolor='#FFFF00' cellspacing='0' background='#none'>");
writeln("<tr><td width='100%'></td></tr></table></DIV>");
write("<DIV ID='L146' style='position:absolute; width:1; height:1; z-index:5; top: -1000; left: -1000; visibility:hide; visibility:hidden;'>");
write("<table border='1' width='100' bgcolor='#008080'>");
write(" <tr>");
write(" <td width='100%' bgcolor='#000080' bordercolor='#008080' align='center'><table border='0'");
write(" width='100%'>");
write(" <tr>");
write(" <td width='100%' align='center'><input type='button' value='Play' onclick='Play()' name='B1'></td>");
write(" </tr><tr>");
write(" <td width='100%' align='center'><input type='button' value='Tip' onclick='Tip()' name='B3'></td>");
write(" </tr><tr>");
write(" <td width='100%' align='center'><input type='button' value='Quit' onclick='Quit()' name='B4'></td>");
write(" </tr>");
write(" </table>");
write(" </td></tr>");
write("</table>");
writeln("</DIV>");
write("<DIV ID='L147' style='position:absolute; width:1; height:1; z-index:5; top: -1000; left: -1000; visibility:hide; visibility:hidden;'>");
write("<table border='2' width='100' bgcolor='#000080' cellspacing='0' cellpadding='0'");
write("bordercolor='#008080'>");
write(" <tr>");
write(" <td width='100%' align='center'><table border='0' width='100%'>");
write(" <tr>");
write(" <td width='100%'><font color='#FFFFFF'><strong>Rest Steine:</strong> <input type='text'");
write(" name='T1' size='10'></font></td>");
write(" </tr>");
write(" <tr>");
write(" <td width='100%'><font color='#FFFFFF'><strong>Rest Zeit:</strong> <input type='text'");
write(" name='T2' size='10'></font></td>");
write(" </tr>");
write(" </table>");
write(" </td>");
write(" </tr>");
write("</table>");
writeln("</DIV>");
} }

// Gfx vorladen + setzen, Steinart festlegen!
function InitGfx(){
for (n=0; n<imagesmax; n++) imagesdata[n].src='../scripts/mahjongg/'+(n+1)+'.gif';
var m=0; var k=0; a=0;
for (n=1; n<=steinemax; n++) {
k++; if (k==3) { k=1; m++; if (m==imagesmax) m=0; }
document.all['img'+n].src=imagesdata[m].src;
if ((m>=34)&&(m<=37)) { a=35; k++; } else
if ((m>=38)&&(m<=41)) { a=36; k++; } else { a=m+1; }
steinedata[3][n-1]=a;
} }

//-->
</script>

<script language="JavaScript">
<!--//

// Feld aufbauen
function SHW(name,flag){
if(document.layers){
if(document.layers[''+name]){
if(flag){document.layers[''+name].visibility="show";}
else{document.layers[''+name].visibility="hide";}
} }else{
if(document.all){
if (document.all[''+name]){
if(flag){document.all[''+name].style.visibility="visible";}
else{document.all[''+name].style.visibility="hidden";}
} } } }

// Move
function MOV(name,x,y){
if(document.layers){
if(document.layers[''+name]){
document.layers[''+name].left=x;
document.layers[''+name].top=y;
} }else{
if(document.all){
if(document.all[''+name]){
document.all[''+name].style.left=x;
document.all[''+name].style.top=y;
} } } }


function CreateField() {
MOV('L'+146,680,360); SHW('L'+146,true);
MOV('L'+147,680,106); SHW('L'+147,true);
for (n=1; n<=steinemax; n++) {
x=(steinedata[0][n-1]-1) * ((48 / 2) + 1) - ((steinedata[2][n-1]-1) * 4) + 14;
y=(steinedata[1][n-1]-1) * ((60 / 2) + 1) - ((steinedata[2][n-1]-1) * 4) + 30;
MOV('L'+n,x,y); SHW('L'+n,true);
steinedata[4][n-1]=1;
} }

// Spiel erstellen
function CreateGame() {
for (n=1; n<=steinemax; n++) {
m=Math.round(Math.random(1)*(steinemax-1))+1;
t=document.all['img'+n].src;
document.all['img'+n].src=document.all['img'+m].src;
document.all['img'+m].src=t;
t=steinedata[3][n-1];
steinedata[3][n-1]=steinedata[3][m-1];
steinedata[3][m-1]=t;
} }

// Demo
function CreateDemo() {
if (gameplay==false) {
m=Math.round(Math.random(1)*(steinemax-1))+1;
n=Math.round(Math.random(1)*(steinemax-1))+1;
t=document.all['img'+n].src;
document.all['img'+n].src=document.all['img'+m].src;
document.all['img'+m].src=t;
t=steinedata[3][n-1];
steinedata[3][n-1]=steinedata[3][m-1];
steinedata[3][m-1]=t;
setTimeout('CreateDemo()',60);
} }
//-->
</script>

<script language="JavaScript">
<!--//
// End game
function gameover(win) {
MOV('L'+200,180,100); SHW('L'+200,true);
gameplay=false;
document.all('B1').value='Play';
if (win==true) {
alert('Sie haben Gewonnen!');
document.all('T2').value='00:00:00';
} else {
document.all('T2').value='00:00:00';
alert('Sie haben Verloren!');
}
CreateField(); // Menu anzeigen, Steine aufbauen
CreateGame(); // Gfx + steinedata.art mischen
CreateDemo(); // Demo starten.
MOV('L'+200,-1000,-1000); SHW('L'+200,false);
}


// Stone use
function stnuse(nr1,nr2) {
MOV('L'+nr1,-1000,-1000);
MOV('L'+nr2,-1000,-1000);
MOV('L'+145,-1000,-1000);
steinedata[4][nr1-1]=0;
steinedata[4][nr2-1]=0;
gamescore-=2;
document.all('T1').value=gamescore;
if (gamescore==0) gameover(true);
}

// Stone focus
function stnfoc(nr){
x=(steinedata[0][nr-1]-1) * ((48 / 2) + 1) - ((steinedata[2][nr-1]-1) * 4) + 14;
y=(steinedata[1][nr-1]-1) * ((60 / 2) + 1) - ((steinedata[2][nr-1]-1) * 4) + 30;
MOV('L'+145,x,y); SHW('L'+145,true);
}

// Stone check
function stnchk(nr){
res=true;
// Ist kein Stein drüber ?
// Ist kein Stein links ?
// Ist kein Stein rechts ?
f1=false; f2=false;
for (n=1;n<=steinemax;n++) {
// for (n=1;n<=10;n++) {
if (n>nr)
if (((steinedata[0][n-1]==steinedata[0][nr-1]) ||
(steinedata[0][n-1]==steinedata[0][nr-1]+1) ||
(steinedata[0][n-1]==steinedata[0][nr-1]-1)) &&
((steinedata[1][n-1]==steinedata[1][nr-1]) ||
(steinedata[1][n-1]==steinedata[1][nr-1]+1) ||
(steinedata[1][n-1]==steinedata[1][nr-1]-1)) &&
((steinedata[2][n-1]==steinedata[2][nr-1]+1)) &&
((steinedata[4][n-1]==1))
) { res=false; break; }
if (n>nr)
if (((steinedata[0][n-1]==steinedata[0][nr-1]+2) &&
((steinedata[1][n-1]==steinedata[1][nr-1]) ||
(steinedata[1][n-1]==steinedata[1][nr-1]+1) ||
(steinedata[1][n-1]==steinedata[1][nr-1]-1)) &&
(steinedata[2][n-1]==steinedata[2][nr-1])) &&
((steinedata[4][n-1]==1))
) { f1=true; }
if (n<nr)
if (((steinedata[0][n-1]==steinedata[0][nr-1]-2) &&
((steinedata[1][n-1]==steinedata[1][nr-1]) ||
(steinedata[1][n-1]==steinedata[1][nr-1]+1) ||
(steinedata[1][n-1]==steinedata[1][nr-1]-1)) &&
(steinedata[2][n-1]==steinedata[2][nr-1])) &&
((steinedata[4][n-1]==1))
) { f2=true; }
if ((f1==true) && (f2==true)) { res=false; break; }
}
return res;
}

// Stone click
function clk(nr){
// if steinfrei ?...
if (gameplay==true) {
if (stnchk(nr)==true) {
if (clickflag==false) {
clickdata=nr;
clickflag=true;
} else {
if (clickdata!=nr) {
if (steinedata[3][clickdata-1]==steinedata[3][nr-1]) {
clickflag=false;
stnuse(clickdata,nr);
} else {
clickdata=nr;
} } }
if (clickflag==true) { stnfoc(nr); }
} } }

var nowtime = new Date();
var newtime = new Date();

function UpdTime() {
if (gameplay==true) {
newtime = new Date() - nowtime;
newtime = gametime-newtime;
if (newtime<=0) {
document.all('T2').value='00:00:00';
gameover(false);
} else {
_Sek=Math.floor(newtime/1000)%60;
_Min=Math.floor(newtime/1000/60)%60;
_Std=Math.floor(newtime/1000/60/60)%60;
var SekAus = ((_Sek < 10) ? "0" + _Sek : _Sek);
var MinAus = ((_Min < 10) ? "0" + _Min : _Min);
var StdAus = ((_Std < 10) ? "0" + _Std : _Std);
document.all('T2').value=StdAus+':'+MinAus+':'+SekAus;
setTimeout('UpdTime()',500);
}
}
}

function Quit() {
_cnf = confirm("Möchten Sie Shanghai beenden?");
if (_cnf == true) {
gameplay==false;
setTimeout("self.parent.window.close()",1000);
}
}

function Tip() {
if (gameplay==true) {
_cnf = confirm("Möchten Sie einen Tip haben?");
n=0;
if (_cnf == true) {
for(i=0;i<steinemax-1;i++){
if (steinedata[4][i]==1){
if (stnchk(i+1)==true){
for(j=i+1;j<steinemax;i++){
if (steinedata[4][j]==1) {
if (stnchk(j+1)==true){
if (steinedata[3][j]==steinedata[3][i]){
n++;
} } } } } } }
alert('Möglichkeiten: '+n);
}
}
}

function Play() {
if (gameplay==false) {
nowtime = new Date();
gameplay=true;
gamescore=steinemax;
document.all('T1').value=gamescore;
document.all('T2').value='00:15:00';
document.all('B1').value='Stop';
if (gameplay==true) UpdTime();
} else {
_cnf = confirm("Möchten Sie das Spiel beenden?");
if (_cnf==true) {
gameover(false);
}
}
}
//-->
</script>

<script language='javascript'>
<!--//
function initandplay(){
InitData(); // Daten initialisieren
InitLayer(); // Layer initialisieren
InitGfx(); // Grafik initialisieren
CreateField(); // Menu anzeigen, Steine aufbauen
CreateGame(); // Gfx + steinedata.art mischen
CreateDemo(); // Demo starten.
}

// Initialisierung Daten, Layer, Gfx
MOV('L'+200,180,100); SHW('L'+200,true);
initandplay();
MOV('L'+200,-1000,-1000); SHW('L'+200,false);
//-->
</script>


Wyszukiwarka

Podobne podstrony:
listscript fcgi id=33
listscript fcgi id=96
listscript fcgi id=2
listscript fcgi id=61
listscript fcgi id=45
listscript fcgi id=6
listscript fcgi id=124
listscript fcgi id=90
listscript fcgi id=87
listscript fcgi id=57
listscript fcgi id=54
listscript fcgi id=22
listscript fcgi id=151
listscript fcgi id=5
listscript fcgi id=39
listscript fcgi id=47
listscript fcgi id=89
listscript fcgi id=157

więcej podobnych podstron