»
AnglaisFrançaisVietnamien

Imprimer - Mine de recherche - JavaScriptBank.com

Version complète: jsB@nk » Game » Mine de recherche
URL: https://www.javascriptbank.com/mine-search-index.html

Mine de recherche © JavaScriptBank.comUne autre version de Widow's démineur. Votre lecteur commence à l'angle supérieur gauche de la carte et ressemble à un smiley. Utilisez la logique et la chance de manÅ“uvrer à travers le petit drapeau dans le coin inférieur droit. Utilisez les flèches (4, 8, 6, et 2) sur le numberpad touches pour déplacer le joueur. Regardez la zone de texte ci-dessus le jeu pour savoir combien de mines sont actuellement près de vous.

Version complète: jsB@nk » Game » Mine de recherche
URL: https://www.javascriptbank.com/mine-search-index.html



CSS
<style>body{background-color:white;font-size:10pt;font-family:sans-serif;color:#00436e;}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
Based on a game on the HP48 calculator<br><script language="javascript">var w3c=(document.getElementById)?true:false;var ns4=(document.layers)?true:false;var ie4=(document.all && !w3c)?true:false;var ie5=(document.all && w3c)?true:false;var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;var minearray=new Array();for(c=0;c<22;c++)minearray[c]=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var mines=0;var plc=[1,1,1,1];var ctr=0;var d;var plx=1;var ply=1;var play=true;var minecounter=0;var images=new Array();for(i=0;i<5;i++){images[i]=new Image();images[i].src='pic'+i+'.gif';}function init(){d=document.images;d.c1r1.src="pic4.gif";d.c30r20.src="pic2.gif";while(ctr<mines){c=(Math.floor(Math.random()*30)+1);r=(Math.floor(Math.random()*20)+1);if(((''+r+c)!='11')&&(minearray[r][c]!=1)&&((''+r+c)!='2030')){ctr++;minearray[r][c]=1;}}if(ns4)document.captureEvents(Event.KEYPRESS);document.onkeypress=showkey;adjctr();alert('INSTRUCTIONS:\n\n- Use the arrow (4, 8, 6, and 2) keys on the numberpad to move the player.\n- Look at the text box above the game to find out how many mines you are presently near.\n- Your player starts at the upper left hand corner of the board and looks like a smiley face.\n- Use logic and luck to maneuver your way through to the little flag in the lower right hand corner.'+((ns6)?'\nClick on the document first with the mouse so the keys work.':''));}function showkey(keypress){var wk=(ie4||ie5)? event.keyCode: keypress.which;if(play){if((wk==52)&&(plx!=1)) plc=[ plx, plx-1, ply, ply ];else if((wk==54)&&(plx!=30)) plc=[ plx, plx+1, ply, ply ];else if((wk==56)&&(ply!=1)) plc=[ plx, plx, ply, ply-1 ];else if((wk==50)&&(ply!=20)) plc=[ plx, plx, ply, ply+1 ];else if((wk==49)&&(plx!=1)&&(ply!=20)) plc=[ plx, plx-1, ply, ply+1 ];else if((wk==51)&&(plx!=30)&&(ply!=20)) plc=[ plx, plx+1, ply, ply+1 ];else if((wk==55)&&(plx!=1)&&(ply!=1)) plc=[ plx, plx-1, ply, ply-1 ];else if((wk==57)&&(plx!=30)&&(ply!=1)) plc=[ plx, plx+1, ply, ply-1 ];d['c'+plc[0]+'r'+plc[2]].src='pic1.gif';d['c'+plc[1]+'r'+plc[3]].src='pic4.gif';plx=plc[1];ply=plc[3];if((''+plx+ply)=='3020')endgame('Congratulations! You made it!');else adjctr();return false;}}function adjctr(){minecounter=0;if(minearray[ply-1][plx-1]==1)minecounter++;if(minearray[ply-1][plx]==1)minecounter++;if(minearray[ply-1][plx+1]==1)minecounter++;if(minearray[ply][plx-1]==1)minecounter++;if(minearray[ply][plx+1]==1)minecounter++;if(minearray[ply+1][plx-1]==1)minecounter++;if(minearray[ply+1][plx]==1)minecounter++;if(minearray[ply+1][plx+1]==1)minecounter++;document.f.t.value=minecounter;if(minearray[ply][plx]==1)endgame('You Blew Up!!');}function endgame(msg){play=false;alert(msg);for(r=1;r<21;r++){for(c=1;c<31;c++){if(minearray[r][c]==1)d[('c'+c+'r'+r)].src="pic3.gif";}}}window.onload=init;while(mines<10)mines=prompt('Enter the number of mines (the more, the harder).',10);var txt='<form name="f"><b>You are near <input type="text" name="t" value=0 size=2> mine(s)</b></form><table cellpadding=0 cellspacing=0 border=5><tr><td nowrap>';for(r=1;r<21;r++){for(c=1;c<31;c++)txt+='<img src="pic0.gif" name="c'+c+'r'+r+'">';txt+='<br>';}document.write(txt+'</td></tr></table>');</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/game/Mine_Search/pic0.gifhttp://javascriptbank.com/javascript/game/Mine_Search/pic1.gifhttp://javascriptbank.com/javascript/game/Mine_Search/pic2.gifhttp://javascriptbank.com/javascript/game/Mine_Search/pic3.gifhttp://javascriptbank.com/javascript/game/Mine_Search/pic4.gif