home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOKAN 22
/
DOKAN22.iso
/
Webs
/
www.crosswinds.net
/
~hendra
/
puzzle.js
< prev
next >
Wrap
Text File
|
2000-02-07
|
12KB
|
445 lines
<!--Hide JavaScript from Java-Impaired Browsers
var gif=new Array();
for (var i=0;i<10;i++){
gif[i]=new Image();
gif[i].src="p/sc"+i+".gif";
}
gif[10]=new Image();
gif[10].src="p/wh.gif";
gif[11]=new Image();
gif[11].src="p/wh.gif";
var rflg=0;
var ls="";
var mflg=0;
var olr=0;
var olc=0;
var orr=0;
var orc=0;
var rr=1;
var rc=1;
var p="p/"
var g=".gif"
var gl="4d2c3d4b7e6d3b2a3c3a1b1e4a5c2e7b"
+"6e4c6b3e2b7c5a1d5e1a6c5b7d1c7a2d6a5d4e";
var gr="whwhwhwhwhwhwhwhwhwhwhwhwhwhwhwh"
+"whwhwhwhwhwhwhwhwhwhwhwhwhwhwhwhwhwhwh";
var gc="1a2a3a4a5a6a7a1b2b3b4b5b6b7b1c2c"
+"3c4c5c6c7c1d2d3d4d5d6d7d1e2e3e4e5e6e7e";
var score=0;
var ctr=0;
var okflg=0;
var scostr="";
var ns="01234567890 ";
function butLight(){
pos=((lr*7)+lc-8)*2;
if (mflg<1&&gl.substring(pos,pos+2)!="wh"){
document.move.src="p/ml.gif";
}
}
function butrLight(){
if (mflg==1){
document.place.src="p/pl.gif";
}
}
function butPlace(){
if (mflg==1){
mflg=0;
document.place.src="p/pld.gif";
setTimeout('clrrMove()',500);
}
}
function clrrMove(){
placeIt();
if (okflg==1){
okflg=0;
document.cur.src="p/mcur.gif";
document.inst.src="p/wh.gif";
document.move.src="p/md.gif";
document.sel.src=document.sel.src;
document.sel1.src="p/wh.gif";
document.mid.src="p/wh.gif";
document.mid1.src="p/wh.gif";
document.place.src="p/wh.gif";
document.rro1.src="p/wh.gif";
document.rro2.src="p/wh.gif";
document.rro3.src="p/wh.gif";
document.rro4.src="p/wh.gif";
document.rro5.src="p/wh.gif";
document.rcl1.src="p/wh.gif";
document.rcl2.src="p/wh.gif";
document.rcl3.src="p/wh.gif";
document.rcl4.src="p/wh.gif";
document.rcl5.src="p/wh.gif";
document.rcl6.src="p/wh.gif";
document.rcl7.src="p/wh.gif";
lcdark();
lrdark();
}
else{
mflg=1;
document.place.src="p/pd.gif";
}
}
function butDown(){
pos=((lr*7)+lc-8)*2;
if (mflg<1&&gl.substring(pos,pos+2)!="wh"){
mflg=1
document.move.src="p/mld.gif";
setTimeout('clrMove()',500);
}
}
function clrMove(){
document.cur.src="p/wh.gif";
document.inst.src="p/mcurr.gif";
document.move.src="p/wh.gif";
document.sel1.src=document.sel.src;
document.sel.src="p/wh.gif";
document.mid1.src=document.mid.src;
document.mid.src="p/wh.gif";
document.place.src="p/pd.gif";
document.lro1.src="p/wh.gif";
document.lro2.src="p/wh.gif";
document.lro3.src="p/wh.gif";
document.lro4.src="p/wh.gif";
document.lro5.src="p/wh.gif";
document.lcl1.src="p/wh.gif";
document.lcl2.src="p/wh.gif";
document.lcl3.src="p/wh.gif";
document.lcl4.src="p/wh.gif";
document.lcl5.src="p/wh.gif";
document.lcl6.src="p/wh.gif";
document.lcl7.src="p/wh.gif";
rcdark();
rrdark();
reMover();
}
function display(stuff){
parent.window.status=stuff;
}
function leftRb(){
if (mflg==0){
if (olr!=lr){lrdark();}
if (olc!=lc){lcdark();}
pos=((lr*7)+lc-8)*2;
document.mid.src=p+gl.substring(pos,pos+2)+g;
}
olr=lr;
olc=lc
}
function lrdark(){
document.lro1.src="p/rbd.gif";
document.lro2.src="p/rbd.gif";
document.lro3.src="p/rbd.gif";
document.lro4.src="p/rbd.gif";
document.lro5.src="p/rbd.gif";
if (lr==1){
document.lro1.src="p/rbl.gif";
}
if (lr==2){
document.lro2.src="p/rbl.gif";
}
if (lr==3){
document.lro3.src="p/rbl.gif";
}
if (lr==4){
document.lro4.src="p/rbl.gif";
}
if (lr==5){
document.lro5.src="p/rbl.gif";
}
}
function lcdark(){
document.lcl1.src="p/rbd.gif";
document.lcl2.src="p/rbd.gif";
document.lcl3.src="p/rbd.gif";
document.lcl4.src="p/rbd.gif";
document.lcl5.src="p/rbd.gif";
document.lcl6.src="p/rbd.gif";
document.lcl7.src="p/rbd.gif";
if (lc==1){
document.lcl1.src="p/rbl.gif";
}
if (lc==2){
document.lcl2.src="p/rbl.gif";
}
if (lc==3){
document.lcl3.src="p/rbl.gif";
}
if (lc==4){
document.lcl4.src="p/rbl.gif";
}
if (lc==5){
document.lcl5.src="p/rbl.gif";
}
if (lc==6){
document.lcl6.src="p/rbl.gif";
}
if (lc==7){
document.lcl7.src="p/rbl.gif";
}
}
function rightRb(){
if (mflg==1){
if (orr!=rr){rrdark();}
if (orc!=rc){rcdark();}
}
orr=rr;
orc=rc;
}
function rrdark(){
document.rro1.src="p/rbd.gif";
document.rro2.src="p/rbd.gif";
document.rro3.src="p/rbd.gif";
document.rro4.src="p/rbd.gif";
document.rro5.src="p/rbd.gif";
if (rr==1){
document.rro1.src="p/rbl.gif";
}
if (rr==2){
document.rro2.src="p/rbl.gif";
}
if (rr==3){
document.rro3.src="p/rbl.gif";
}
if (rr==4){
document.rro4.src="p/rbl.gif";
}
if (rr==5){
document.rro5.src="p/rbl.gif";
}
}
function rcdark(){
document.rcl1.src="p/rbd.gif";
document.rcl2.src="p/rbd.gif";
document.rcl3.src="p/rbd.gif";
document.rcl4.src="p/rbd.gif";
document.rcl5.src="p/rbd.gif";
document.rcl6.src="p/rbd.gif";
document.rcl7.src="p/rbd.gif";
if (rc==1){
document.rcl1.src="p/rbl.gif";
}
if (rc==2){
document.rcl2.src="p/rbl.gif";
}
if (rc==3){
document.rcl3.src="p/rbl.gif";
}
if (rc==4){
document.rcl4.src="p/rbl.gif";
}
if (rc==5){
document.rcl5.src="p/rbl.gif";
}
if (rc==6){
document.rcl6.src="p/rbl.gif";
}
if (rc==7){
document.rcl7.src="p/rbl.gif";
}
}
function prtScr(){
document.l1a.src=p+gl.substring(0,2)+g;
document.l1b.src=p+gl.substring(2,4)+g;
document.l1c.src=p+gl.substring(4,6)+g;
document.l1d.src=p+gl.substring(6,8)+g;
document.l1e.src=p+gl.substring(8,10)+g;
document.l1f.src=p+gl.substring(10,12)+g;
document.l1g.src=p+gl.substring(12,14)+g;
document.l2a.src=p+gl.substring(14,16)+g;
document.l2b.src=p+gl.substring(16,18)+g;
document.l2c.src=p+gl.substring(18,20)+g;
document.l2d.src=p+gl.substring(20,22)+g;
document.l2e.src=p+gl.substring(22,24)+g;
document.l2f.src=p+gl.substring(24,26)+g;
document.l2g.src=p+gl.substring(26,28)+g;
document.l3a.src=p+gl.substring(28,30)+g;
document.l3b.src=p+gl.substring(30,32)+g;
document.l3c.src=p+gl.substring(32,34)+g;
document.l3d.src=p+gl.substring(34,36)+g;
document.l3e.src=p+gl.substring(36,38)+g;
document.l3f.src=p+gl.substring(38,40)+g;
document.l3g.src=p+gl.substring(40,42)+g;
document.l4a.src=p+gl.substring(42,44)+g;
document.l4b.src=p+gl.substring(44,46)+g;
document.l4c.src=p+gl.substring(46,48)+g;
document.l4d.src=p+gl.substring(48,50)+g;
document.l4e.src=p+gl.substring(50,52)+g;
document.l4f.src=p+gl.substring(52,54)+g;
document.l4g.src=p+gl.substring(54,56)+g;
document.l5a.src=p+gl.substring(56,58)+g;
document.l5b.src=p+gl.substring(58,60)+g;
document.l5c.src=p+gl.substring(60,62)+g;
document.l5d.src=p+gl.substring(62,64)+g;
document.l5e.src=p+gl.substring(64,66)+g;
document.l5f.src=p+gl.substring(66,68)+g;
document.l5g.src=p+gl.substring(68,70)+g;
sco1=1000;
}
function prtrScr(){
ctr=0;
okflg=1;
document.r1a.src=p+gr.substring(0,2)+g;
document.r1b.src=p+gr.substring(2,4)+g;
document.r1c.src=p+gr.substring(4,6)+g;
document.r1d.src=p+gr.substring(6,8)+g;
document.r1e.src=p+gr.substring(8,10)+g;
document.r1f.src=p+gr.substring(10,12)+g;
document.r1g.src=p+gr.substring(12,14)+g;
document.r2a.src=p+gr.substring(14,16)+g;
document.r2b.src=p+gr.substring(16,18)+g;
document.r2c.src=p+gr.substring(18,20)+g;
document.r2d.src=p+gr.substring(20,22)+g;
document.r2e.src=p+gr.substring(22,24)+g;
document.r2f.src=p+gr.substring(24,26)+g;
document.r2g.src=p+gr.substring(26,28)+g;
document.r3a.src=p+gr.substring(28,30)+g;
document.r3b.src=p+gr.substring(30,32)+g;
document.r3c.src=p+gr.substring(32,34)+g;
document.r3d.src=p+gr.substring(34,36)+g;
document.r3e.src=p+gr.substring(36,38)+g;
document.r3f.src=p+gr.substring(38,40)+g;
document.r3g.src=p+gr.substring(40,42)+g;
document.r4a.src=p+gr.substring(42,44)+g;
document.r4b.src=p+gr.substring(44,46)+g;
document.r4c.src=p+gr.substring(46,48)+g;
document.r4d.src=p+gr.substring(48,50)+g;
document.r4e.src=p+gr.substring(50,52)+g;
document.r4f.src=p+gr.substring(52,54)+g;
document.r4g.src=p+gr.substring(54,56)+g;
document.r5a.src=p+gr.substring(56,58)+g;
document.r5b.src=p+gr.substring(58,60)+g;
document.r5c.src=p+gr.substring(60,62)+g;
document.r5d.src=p+gr.substring(62,64)+g;
document.r5e.src=p+gr.substring(64,66)+g;
document.r5f.src=p+gr.substring(66,68)+g;
document.r5g.src=p+gr.substring(68,70)+g;
document.sel.src="p/sel.gif";
score+=sco1;
scostr="";
scostr+=score;
scctr=0;
while (scostr.length<5){
scostr=" "+scostr;
}
pos=ns.indexOf(scostr.substring(0,1));
document.sc1.src=gif[pos].src;
pos=ns.indexOf(scostr.substring(1,2));
document.sc2.src=gif[pos].src;
pos=ns.indexOf(scostr.substring(2,3));
document.sc3.src=gif[pos].src;
pos=ns.indexOf(scostr.substring(3,4));
document.sc4.src=gif[pos].src;
pos=ns.indexOf(scostr.substring(4,5));
document.sc5.src=gif[pos].src;
lrdark();
lcdark();
document.ctr.src="p/wh.gif";
if (gr==gc){
document.move.src="p/wh.gif";
alert("Your score is "+ scostr +".\nClick OK to continue");award();
}
}
function reMover(){
pos=((lr*7)+lc-8)*2;
piec=gl.substring(pos,pos+2);
gl=gl.substring(0,pos)+"wh"+gl.substring(pos+2,gl.length);
prtScr();
}
function placeIt(){
pos=((rr*7)+rc-8)*2;
if (gr.substring(pos,pos+2)!="wh"){
alert("There is already a piece in the "
+"position selected. No penalty, though"
+". Try again!");
okflg=0;
}
else{
placeIt1();
}
}
function placeIt1(){
if (gc.substring(pos,pos+2)!=piec){
wrongPlace();
}
else{
gr=gr.substring(0,pos)+piec+gr.substring(pos+2,gr.length);
prtrScr();
}
}
function wrongPlace(){
ctr++;
if (ctr<4){
document.inst.src="p/wrong.gif";
document.ctr.src=gif[ctr].src;
sco1=sco1-250;
}
else{
pos=gc.indexOf(piec);
gr=gr.substring(0,pos)+piec+gr.substring(pos+2,gr.length);
prtrScr();
}
}
function award()
{
document.writeln('<html>\n'
+'<head>\n'
+'<title>Conan Puzzle Award</title>\n'
+'</head>\n'
+'<body background="images/back2cn.jpg">\n'
+'<table width="750">\n'
+' <tr>\n'
+' <td colspan="2" align="center"><h1><font color="red">Congratulations, Your score is '+ scostr +'</font></h1><hr></td>\n'
+' </tr>\n'
+' <tr>\n'
+' <td width="150" valign="top" align="center"><b>You have arranged the puzzle with '+ scostr +' score.\n'
+' For the reward, I shall send you an award.<br>\n'
+' Ok, fill this form, and wait for your award.\n'
+' <p>Note : By the time this page loaded, it will report a script error.\n'
+' Just ignore the message by pressing "OK" or "Yes" button.</b></td>\n'
+' <td><form method="POST" action="http://www.chip.co.id/cgi-bin/formmail.pl">\n'
+' <input type="hidden" name="subject" value="Conan Puzzle award : '+ scostr +'">\n'
+' <input type="hidden" name="recipient" value="hendra@crosswinds.net">\n'
+' <input type="hidden" name="redirect" value="http://www.crosswinds.net/~hendra/puzzle.html">\n'
+' <Blockquote>Your Nameá <input type="text" name="name" size="25">\n'
+' <p>Your E-mail <input type="text" name="email" size="25">\n'
+' <p>Your Website (if you have any)<br>\n'
+' <input type="text" name="Website" size="40">\n'
+' <p>Do you want me to list your name in "Winners Record" ?\n'
+' <blockquote>\n'
+' <p><input type="radio" value="Yes" name="List">Yes <input type="radio" name="List" value="No">No\n'
+' </blockquote>\n'
+' <p>This is optional. Do you want me to list : <br>\n'
+' <input type="checkbox" name="List Mail" value="Yes">Your E-mail<br>\n'
+' <input type="checkbox" name="List Website" value="Yes">Your Website<br>\n'
+' <input type="checkbox" name="List Score" value="Yes">Your Score\n'
+' <p>Anything you want to sayáto me<p><textarea rows="5" name="Comments" cols="30">\n'
+' </TEXTAREA> \n'
+' <input type="submit" value="Submit" name="Submit"></form></blockquote>\n'
+' </td>\n'
+' </tr></table>\n'
+'</body>\n'
+'</html>');
}
// End Hiding -->