| 1 | <html>
|
|---|
| 2 | <head>
|
|---|
| 3 | <script>
|
|---|
| 4 | <!--
|
|---|
| 5 | var STATE_WALL = "9"; //�� |
|---|
| 6 | var STATE_YET = "0"; //���I��ar STATE_FINISH = "1"; //�I�� |
|---|
| 7 | var STATE_FLAG = "2"; //��var blnStartFlg;
|
|---|
| 8 | var blnBusyFlg;
|
|---|
| 9 |
|
|---|
| 10 | var dtmTime;
|
|---|
| 11 |
|
|---|
| 12 | var objTimer;
|
|---|
| 13 |
|
|---|
| 14 | var intCellX = 16;
|
|---|
| 15 | var intCellY = 33;
|
|---|
| 16 | var intBomb = 99;
|
|---|
| 17 |
|
|---|
| 18 | var intCellXBuf;
|
|---|
| 19 | var intCellYBuf;
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | var intIndex0;
|
|---|
| 23 | var intIndex1;
|
|---|
| 24 | var intIndexX;
|
|---|
| 25 | var intIndexY;
|
|---|
| 26 |
|
|---|
| 27 | var ablnBomb;
|
|---|
| 28 | var aintState;
|
|---|
| 29 | var aintCheck;
|
|---|
| 30 | var aintCount;
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | var aimgNumber;
|
|---|
| 34 | var imgMiss;
|
|---|
| 35 | var imgBomb;
|
|---|
| 36 | var imgFlag;
|
|---|
| 37 | var imgMistake;
|
|---|
| 38 | var imgSpace;
|
|---|
| 39 | var imgFinish;
|
|---|
| 40 |
|
|---|
| 41 | var asrcNumber;
|
|---|
| 42 | var srcBomb;
|
|---|
| 43 | var srcMiss;
|
|---|
| 44 | var srcFlag;
|
|---|
| 45 | var srcMistake;
|
|---|
| 46 | var srcSpace;
|
|---|
| 47 | var srcFinish;
|
|---|
| 48 |
|
|---|
| 49 | /***************************************
|
|---|
| 50 | �摜�Ǎ�
|
|---|
| 51 | ***************************************/
|
|---|
| 52 | function fncImage(){
|
|---|
| 53 |
|
|---|
| 54 | //�g�p�摜���� pathImgDir = frm.code.value;
|
|---|
| 55 | if(!pathImgDir){
|
|---|
| 56 | pathImgDir = window.location.search.replace("?","").match(/^\w+$/);
|
|---|
| 57 | if(!pathImgDir){
|
|---|
| 58 | pathImgDir = "default";
|
|---|
| 59 | }
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | document.getElementById("idCode").value = pathImgDir;
|
|---|
| 63 |
|
|---|
| 64 | //���l�摜�p�z��aimgNumber = new Array();
|
|---|
| 65 | asrcNumber = new Array();
|
|---|
| 66 |
|
|---|
| 67 | //�摜URL�쐬
|
|---|
| 68 | asrcNumber = new Array( "./image/"+pathImgDir+"/0.png" ,
|
|---|
| 69 | "./image/"+pathImgDir+"/1.png" ,
|
|---|
| 70 | "./image/"+pathImgDir+"/2.png" ,
|
|---|
| 71 | "./image/"+pathImgDir+"/3.png" ,
|
|---|
| 72 | "./image/"+pathImgDir+"/4.png" ,
|
|---|
| 73 | "./image/"+pathImgDir+"/5.png" ,
|
|---|
| 74 | "./image/"+pathImgDir+"/6.png" ,
|
|---|
| 75 | "./image/"+pathImgDir+"/7.png" ,
|
|---|
| 76 | "./image/"+pathImgDir+"/8.png" ,
|
|---|
| 77 | "./image/"+pathImgDir+"/9.png" );
|
|---|
| 78 | srcBomb = "./image/"+pathImgDir+"/bomb.png";
|
|---|
| 79 | srcMiss = "./image/"+pathImgDir+"/miss.png";
|
|---|
| 80 | srcFlag = "./image/"+pathImgDir+"/flag.png";
|
|---|
| 81 | srcMistake = "./image/"+pathImgDir+"/mistake.png";
|
|---|
| 82 | srcSpace = "./image/"+pathImgDir+"/Space.png";
|
|---|
| 83 | srcFinish = "./image/"+pathImgDir+"/Finish.png";
|
|---|
| 84 |
|
|---|
| 85 | //�摜�p�C���[�W�I�u�W�F�N�g����aimgNumber = new Array( new Image() ,
|
|---|
| 86 | new Image() ,
|
|---|
| 87 | new Image() ,
|
|---|
| 88 | new Image() ,
|
|---|
| 89 | new Image() ,
|
|---|
| 90 | new Image() ,
|
|---|
| 91 | new Image() ,
|
|---|
| 92 | new Image() ,
|
|---|
| 93 | new Image() ,
|
|---|
| 94 | new Image() )
|
|---|
| 95 | imgBomb = new Image();
|
|---|
| 96 | imgMiss = new Image();
|
|---|
| 97 | imgFlag = new Image();
|
|---|
| 98 | imgMistake = new Image();
|
|---|
| 99 | imgSpace = new Image();
|
|---|
| 100 | imgFinish = new Image();
|
|---|
| 101 |
|
|---|
| 102 | //�摜�L���b�V���쐬
|
|---|
| 103 | aimgNumber[0].src = asrcNumber[0];
|
|---|
| 104 | aimgNumber[1].src = asrcNumber[1];
|
|---|
| 105 | aimgNumber[2].src = asrcNumber[2];
|
|---|
| 106 | aimgNumber[3].src = asrcNumber[3];
|
|---|
| 107 | aimgNumber[4].src = asrcNumber[4];
|
|---|
| 108 | aimgNumber[5].src = asrcNumber[5];
|
|---|
| 109 | aimgNumber[6].src = asrcNumber[6];
|
|---|
| 110 | aimgNumber[7].src = asrcNumber[7];
|
|---|
| 111 | aimgNumber[8].src = asrcNumber[8];
|
|---|
| 112 | aimgNumber[9].src = asrcNumber[9];
|
|---|
| 113 | imgBomb.src = srcBomb;
|
|---|
| 114 | imgMiss.src = srcMiss;
|
|---|
| 115 | imgFlag.src = srcFlag;
|
|---|
| 116 | imgMistake.src = srcMistake;
|
|---|
| 117 | imgSpace.src = srcSpace;
|
|---|
| 118 | imgFinish.src = srcFinish;
|
|---|
| 119 |
|
|---|
| 120 | document.getElementById("idImgBomb").src = srcBomb;
|
|---|
| 121 | document.getElementById("idImgMiss").src = srcMiss;
|
|---|
| 122 | document.getElementById("idImgFlag").src = srcFlag;
|
|---|
| 123 | document.getElementById("idImgMistake").src = srcMistake;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | /***************************************
|
|---|
| 127 | ���쐬
|
|---|
| 128 | ***************************************/
|
|---|
| 129 | function fncDisp(){
|
|---|
| 130 |
|
|---|
| 131 | var strStageHTML;
|
|---|
| 132 | var strCellX;
|
|---|
| 133 | var strCellY;
|
|---|
| 134 | var strBomb;
|
|---|
| 135 |
|
|---|
| 136 | blnStartFlg = false;
|
|---|
| 137 | blnBusyFlg = false;
|
|---|
| 138 |
|
|---|
| 139 | clearInterval(objTimer);
|
|---|
| 140 |
|
|---|
| 141 | idStage.innerHTML = "";
|
|---|
| 142 |
|
|---|
| 143 | strCellX = document.getElementById("idCellX").value;
|
|---|
| 144 | strCellY = document.getElementById("idCellY").value;
|
|---|
| 145 | strBomb = document.getElementById("idBomb").value;
|
|---|
| 146 |
|
|---|
| 147 | if( strCellX.match(/^[1-9][0-9]?$/)==null ||
|
|---|
| 148 | strCellY.match(/^[1-9][0-9]?$/)==null ||
|
|---|
| 149 | strBomb.match(/^[1-9][0-9]?[0-9]?$/)==null ){
|
|---|
| 150 | alert("level error");
|
|---|
| 151 | return;
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | intCellX = Number(strCellX);
|
|---|
| 155 | intCellY = Number(strCellY);
|
|---|
| 156 | intBomb = Number(strBomb);
|
|---|
| 157 |
|
|---|
| 158 | if(intCellX*intCellY*0.9<intBomb){
|
|---|
| 159 | alert("many bomb error");
|
|---|
| 160 | return;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | //�z��fncInitArray();
|
|---|
| 164 |
|
|---|
| 165 | strStageHTML = "";
|
|---|
| 166 | strStageHTML += "<table border=\"0px\" cellpadding=\"0px\" cellspacing=\"0px\">";
|
|---|
| 167 | for(intIndexX=1;intIndexX<=intCellX;intIndexX++){
|
|---|
| 168 | strStageHTML += "<tr>";
|
|---|
| 169 | for(intIndexY=1;intIndexY<=intCellY;intIndexY++){
|
|---|
| 170 | strStageHTML += "<td>";
|
|---|
| 171 | strStageHTML += "<button";
|
|---|
| 172 | strStageHTML += " id = \"idBtn_"+intIndexX+"_"+intIndexY+"\"";
|
|---|
| 173 | strStageHTML += " class = \"clsBtn\"";
|
|---|
| 174 | strStageHTML += " style = \"border-style:outset;\"";
|
|---|
| 175 | strStageHTML += " tabindex = \"-1\"";
|
|---|
| 176 | strStageHTML += " onclick = \"fncClick("+intIndexX+","+intIndexY+");window.focus();return false;\"";
|
|---|
| 177 | strStageHTML += ">";
|
|---|
| 178 | strStageHTML += "<img";
|
|---|
| 179 | strStageHTML += " src = \""+srcSpace+"\"";
|
|---|
| 180 | strStageHTML += " id = \"idImg_"+intIndexX+"_"+intIndexY+"\"";
|
|---|
| 181 | strStageHTML += ">";
|
|---|
| 182 | strStageHTML += "</button>";
|
|---|
| 183 | strStageHTML += "</td>";
|
|---|
| 184 | }
|
|---|
| 185 | strStageHTML += "</tr>";
|
|---|
| 186 | }
|
|---|
| 187 | strStageHTML += "</table>";
|
|---|
| 188 | idStage.innerHTML = strStageHTML;
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | /***************************************
|
|---|
| 192 | �z��**************************************/
|
|---|
| 193 | function fncInitArray(){
|
|---|
| 194 | ablnBomb = new Array(intCellX+1);
|
|---|
| 195 | aintState = new Array(intCellX+1);
|
|---|
| 196 | aintCheck = new Array(intCellX+1);
|
|---|
| 197 | aintCount = new Array(intCellX+1);
|
|---|
| 198 | for(intIndexX=0;intIndexX<=intCellX+1;intIndexX++){
|
|---|
| 199 | ablnBomb[intIndexX] = new Array(intCellY+1);
|
|---|
| 200 | aintState[intIndexX] = new Array(intCellY+1);
|
|---|
| 201 | aintCheck[intIndexX] = new Array(intCellY+1);
|
|---|
| 202 | aintCount[intIndexX] = new Array(intCellY+1);
|
|---|
| 203 | }
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | /***************************************
|
|---|
| 207 | �{�^�������***************************************/
|
|---|
| 208 | function fncInitState(){
|
|---|
| 209 | for(intIndexX=0;intIndexX<=intCellX+1;intIndexX++){
|
|---|
| 210 | for(intIndexY=0;intIndexY<=intCellY+1;intIndexY++){
|
|---|
| 211 | if( intIndexX==0 || intIndexX==intCellX+1 ||
|
|---|
| 212 | intIndexY==0 || intIndexY==intCellY+1 ){
|
|---|
| 213 | aintState[intIndexX][intIndexY] = STATE_WALL;
|
|---|
| 214 | }else{
|
|---|
| 215 | aintState[intIndexX][intIndexY] = STATE_YET;
|
|---|
| 216 | }
|
|---|
| 217 | }
|
|---|
| 218 | }
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | /***************************************
|
|---|
| 222 | �����ۏ���***************************************/
|
|---|
| 223 | function fncInitCheck(){
|
|---|
| 224 | for(intIndexX=0;intIndexX<=intCellX+1;intIndexX++){
|
|---|
| 225 | for(intIndexY=0;intIndexY<=intCellY+1;intIndexY++){
|
|---|
| 226 | aintCheck[intIndexX][intIndexY] = 0;
|
|---|
| 227 | }
|
|---|
| 228 | }
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | /***************************************
|
|---|
| 232 | ��e������***************************************/
|
|---|
| 233 | function fncInitCount(){
|
|---|
| 234 | for(intIndexX=0;intIndexX<=intCellX+1;intIndexX++){
|
|---|
| 235 | for(intIndexY=0;intIndexY<=intCellY+1;intIndexY++){
|
|---|
| 236 | aintCount[intIndexX][intIndexY] = 0;
|
|---|
| 237 | }
|
|---|
| 238 | }
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | /***************************************
|
|---|
| 242 | ���e�ݒu
|
|---|
| 243 | ***************************************/
|
|---|
| 244 | function fncSetBomb(){
|
|---|
| 245 | //���e�L������ for(intIndexX=0;intIndexX<=intCellX+1;intIndexX++){
|
|---|
| 246 | for(intIndexY=0;intIndexY<=intCellY+1;intIndexY++){
|
|---|
| 247 | ablnBomb[intIndexX][intIndexY] = false;
|
|---|
| 248 | }
|
|---|
| 249 | }
|
|---|
| 250 |
|
|---|
| 251 | //���e�ݒu
|
|---|
| 252 | //�ݒu���e�c���w�� intIndex0 = intBomb;
|
|---|
| 253 |
|
|---|
| 254 | //���e�c����0�ɂȂ��Ń��[�v
|
|---|
| 255 | while(intIndex0>0){
|
|---|
| 256 | //���e�ݒu�ꏊ�̌���
|
|---|
| 257 | intCellXBuf = 1+Math.floor(Math.random()*intCellX)
|
|---|
| 258 | intCellYBuf = 1+Math.floor(Math.random()*intCellY)
|
|---|
| 259 | //���e�ݒu�ꏊ�̌�̔��e�L������ if(!ablnBomb[intCellXBuf][intCellYBuf]){
|
|---|
| 260 | //���e��u
|
|---|
| 261 | ablnBomb[intCellXBuf][intCellYBuf] = true;
|
|---|
| 262 | //��^���̔��e���㏸(���g����
|
|---|
| 263 | for(intIndexX=intCellXBuf-1;intIndexX<=intCellXBuf+1;intIndexX++){
|
|---|
| 264 | for(intIndexY=intCellYBuf-1;intIndexY<=intCellYBuf+1;intIndexY++){
|
|---|
| 265 | aintCount[intIndexX][intIndexY]++;
|
|---|
| 266 | }
|
|---|
| 267 | }
|
|---|
| 268 | //���e�c������
|
|---|
| 269 | intIndex0--
|
|---|
| 270 | }
|
|---|
| 271 | }
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | /***************************************
|
|---|
| 275 | ���x�I��**************************************/
|
|---|
| 276 | function fncLevel(strLevel){
|
|---|
| 277 |
|
|---|
| 278 | var aintLevel = new Array(2);
|
|---|
| 279 |
|
|---|
| 280 | aintLevel["L"] = new Array(8,8,10);
|
|---|
| 281 | aintLevel["M"] = new Array(16,16,40);
|
|---|
| 282 | aintLevel["H"] = new Array(16,30,99);
|
|---|
| 283 |
|
|---|
| 284 | switch(strLevel){
|
|---|
| 285 | case "L":
|
|---|
| 286 | case "M":
|
|---|
| 287 | case "H":
|
|---|
| 288 | document.getElementById("idCellX").value = aintLevel[strLevel][0];
|
|---|
| 289 | document.getElementById("idCellY").value = aintLevel[strLevel][1];
|
|---|
| 290 | document.getElementById("idBomb").value = aintLevel[strLevel][2];
|
|---|
| 291 | document.getElementById("idCellX").readOnly = true;
|
|---|
| 292 | document.getElementById("idCellY").readOnly = true;
|
|---|
| 293 | document.getElementById("idBomb").readOnly = true;
|
|---|
| 294 |
|
|---|
| 295 | break;
|
|---|
| 296 | case "C":
|
|---|
| 297 | document.getElementById("idCellX").readOnly = false;
|
|---|
| 298 | document.getElementById("idCellY").readOnly = false;
|
|---|
| 299 | document.getElementById("idBomb").readOnly = false;
|
|---|
| 300 | break;
|
|---|
| 301 | }
|
|---|
| 302 |
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 | /***************************************
|
|---|
| 306 | �J�n����
|
|---|
| 307 | ***************************************/
|
|---|
| 308 | function fncStart(){
|
|---|
| 309 | fncInitState();
|
|---|
| 310 | fncInitCheck();
|
|---|
| 311 | fncInitCount();
|
|---|
| 312 | fncSetBomb();
|
|---|
| 313 | blnStartFlg = true;
|
|---|
| 314 | dtmTime = new Date();
|
|---|
| 315 | objTimer = setInterval("fncTimer();",500);
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | /***************************************
|
|---|
| 319 | �~�X����
|
|---|
| 320 | ***************************************/
|
|---|
| 321 | function fncMiss(strError,intClickXbuf,intClickYBuf){
|
|---|
| 322 |
|
|---|
| 323 | //�ăX�^�[�g�ɂ͕K��������������B
|
|---|
| 324 | //���쐬����alse�ɂ��Ă��邪
|
|---|
| 325 | //[���T�C�Y�ύX��]�����܂܂�����]�@�\�� |
|---|
| 326 | //�lj�̉\����������alse�����͎c���Ă���
|
|---|
| 327 | blnStartFlg = false;
|
|---|
| 328 |
|
|---|
| 329 | for(intIndexX=1;intIndexX<=intCellX;intIndexX++){
|
|---|
| 330 | for(intIndexY=1;intIndexY<=intCellY;intIndexY++){
|
|---|
| 331 | //click�C�x���g�폜
|
|---|
| 332 | document.getElementById("idBtn_"+intIndexX+"_"+intIndexY).onclick = "window.focus();return false;";
|
|---|
| 333 |
|
|---|
| 334 | if( intIndexX==intClickXbuf &&
|
|---|
| 335 | intIndexY==intClickYBuf ){
|
|---|
| 336 | //�N���b�N�����ʒu
|
|---|
| 337 | document.getElementById("idImg_"+intIndexX+"_"+intIndexY).src = srcMiss;
|
|---|
| 338 | }else{
|
|---|
| 339 | //���e�̗L������ //���e���Ȃ��̂Ɋ���Ă����ꍇ
|
|---|
| 340 | if( !ablnBomb[intIndexX][intIndexY] &&
|
|---|
| 341 | aintState[intIndexX][intIndexY]==STATE_FLAG ){
|
|---|
| 342 | document.getElementById("idImg_"+intIndexX+"_"+intIndexY).src = srcMistake;
|
|---|
| 343 | }
|
|---|
| 344 |
|
|---|
| 345 | //���e�̗L������ //���e�L�̏ꍇ
|
|---|
| 346 | if( ablnBomb[intIndexX][intIndexY] &&
|
|---|
| 347 | aintState[intIndexX][intIndexY]==STATE_YET ){
|
|---|
| 348 | document.getElementById("idImg_"+intIndexX+"_"+intIndexY).src = srcBomb;
|
|---|
| 349 | }
|
|---|
| 350 | }
|
|---|
| 351 | }
|
|---|
| 352 | }
|
|---|
| 353 |
|
|---|
| 354 | clearInterval(objTimer);
|
|---|
| 355 | alert(strError);
|
|---|
| 356 |
|
|---|
| 357 | }
|
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 | /***************************************
|
|---|
| 361 | �N���b�N����
|
|---|
| 362 | ***************************************/
|
|---|
| 363 | function fncClick(intClickX,intClickY){
|
|---|
| 364 |
|
|---|
| 365 | //���������� if(blnBusyFlg){
|
|---|
| 366 | return;
|
|---|
| 367 | }else{
|
|---|
| 368 | blnBusyFlg = true;
|
|---|
| 369 | }
|
|---|
| 370 |
|
|---|
| 371 | //�X�^�[�g��łȂ����X�^�[�g�������
|
|---|
| 372 | if(!blnStartFlg){
|
|---|
| 373 | fncStart();
|
|---|
| 374 | }
|
|---|
| 375 |
|
|---|
| 376 | //window.event.shiftKey :IE�V�t�g�������� //event.modifiers :NN�V�t�g�������� if( window.event.shiftKey ||
|
|---|
| 377 | event.modifiers==4 ){
|
|---|
| 378 | fncClickShift(intClickX,intClickY);
|
|---|
| 379 | }else{
|
|---|
| 380 | fncClickUsually(intClickX,intClickY);
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | //�I������ //�I��Ɗ��E���g
|
|---|
| 384 | intIndex0 = 0;
|
|---|
| 385 | intIndex1 = 0;
|
|---|
| 386 | for(intIndexX=1;intIndexX<=intCellX;intIndexX++){
|
|---|
| 387 | for(intIndexY=1;intIndexY<=intCellY;intIndexY++){
|
|---|
| 388 | //�I���E���g
|
|---|
| 389 | if( aintState[intIndexX][intIndexY]==STATE_FINISH ){
|
|---|
| 390 | intIndex0++;
|
|---|
| 391 | }
|
|---|
| 392 | //���E���g
|
|---|
| 393 | if( aintState[intIndexX][intIndexY]==STATE_FLAG ){
|
|---|
| 394 | intIndex1++;
|
|---|
| 395 | }
|
|---|
| 396 | }
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | //�I��Ɗ��e�[�W�T�C�Y�Ɠ����� |
|---|
| 400 | //���e�Ɠ����Ȃ���
|
|---|
| 401 | if( intCellX*intCellY==intIndex0+intIndex1 &&
|
|---|
| 402 | intBomb==intIndex1 ){
|
|---|
| 403 | //�ăX�^�[�g�ɂ͕K��������������B
|
|---|
| 404 | //���쐬����alse�ɂ��Ă��邪
|
|---|
| 405 | //[���T�C�Y�ύX��]�����܂܂�����]�@�\�� |
|---|
| 406 | //�lj�̉\����������alse�����͎c���Ă���
|
|---|
| 407 | blnStartFlg = false;
|
|---|
| 408 |
|
|---|
| 409 | for(intIndexX=1;intIndexX<=intCellX;intIndexX++){
|
|---|
| 410 | for(intIndexY=1;intIndexY<=intCellY;intIndexY++){
|
|---|
| 411 | //click�C�x���g�폜
|
|---|
| 412 | document.getElementById("idBtn_"+intIndexX+"_"+intIndexY).onclick = "window.focus();return false;";
|
|---|
| 413 | }
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | clearInterval(objTimer);
|
|---|
| 417 | alert("congratulations!!");
|
|---|
| 418 | }
|
|---|
| 419 |
|
|---|
| 420 | //�����I��
|
|---|
| 421 | blnBusyFlg = false;
|
|---|
| 422 |
|
|---|
| 423 | }
|
|---|
| 424 |
|
|---|
| 425 | /***************************************
|
|---|
| 426 | �N���b�N����(�ʏ� |
|---|
| 427 | ***************************************/
|
|---|
| 428 | function fncClickUsually(intClickX,intClickY){
|
|---|
| 429 |
|
|---|
| 430 | var blnCheckFlg;
|
|---|
| 431 |
|
|---|
| 432 | var intIndexXBuf;
|
|---|
| 433 | var intIndexYBuf;
|
|---|
| 434 |
|
|---|
| 435 | //�t���O������Ă����疳��f(aintState[intClickX][intClickY]==STATE_FLAG){
|
|---|
| 436 | return;
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 | //���e�ݒu�ꏊ��������X
|
|---|
| 440 | if(ablnBomb[intClickX][intClickY]){
|
|---|
| 441 | fncMiss("miss!!",intClickX,intClickY);
|
|---|
| 442 | return;
|
|---|
| 443 | }
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 | //�N���b�N�ʒu��ύX
|
|---|
| 447 | intIndex0 = 1;
|
|---|
| 448 | aintCheck[intClickX][intClickY] = intIndex0;
|
|---|
| 449 | aintState[intClickX][intClickY] = STATE_FINISH;
|
|---|
| 450 |
|
|---|
| 451 | //�`�F�b�N����
|
|---|
| 452 | while(true){
|
|---|
| 453 |
|
|---|
| 454 | //�����X�t���O
|
|---|
| 455 | blnCheckFlg = false;
|
|---|
| 456 |
|
|---|
| 457 | //���s�����ۂ��
|
|---|
| 458 | for(intIndexX=1;intIndexX<=intCellX;intIndexX++){
|
|---|
| 459 | for(intIndexY=1;intIndexY<=intCellY;intIndexY++){
|
|---|
| 460 | //���s�����ۂ� |
|---|
| 461 | //���e�����ꍇ
|
|---|
| 462 | if( aintCheck[intIndexX][intIndexY] == intIndex0 &&
|
|---|
| 463 | aintState[intIndexX][intIndexY] != STATE_FLAG &&
|
|---|
| 464 | !ablnBomb[intIndexX][intIndexY] ){
|
|---|
| 465 | //�I�� |
|---|
| 466 | aintState[intIndexX][intIndexY] = STATE_FINISH
|
|---|
| 467 | //click�C�x���g�폜
|
|---|
| 468 | document.getElementById("idBtn_"+intIndexX+"_"+intIndexY).onclick = "window.focus();return false;";
|
|---|
| 469 | //����e���`�F�b�N
|
|---|
| 470 | if(aintCount[intIndexX][intIndexY]==0){
|
|---|
| 471 | //����e���Ȃ��ꍇ
|
|---|
| 472 | //��{�^���Ɏ����������w�� for(intIndexXBuf=intIndexX-1;intIndexXBuf<=intIndexX+1;intIndexXBuf++){
|
|---|
| 473 | for(intIndexYBuf=intIndexY-1;intIndexYBuf<=intIndexY+1;intIndexYBuf++){
|
|---|
| 474 | //�����ۂɂȂ�Ă��Ȃ��ꍇ�A�����������ۂƂ������X�t���O�𗧂Ă� if(aintCheck[intIndexXBuf][intIndexYBuf]==0){
|
|---|
| 475 | aintCheck[intIndexXBuf][intIndexYBuf] = intIndex0 + 1;
|
|---|
| 476 | blnCheckFlg = true;
|
|---|
| 477 | }
|
|---|
| 478 | }
|
|---|
| 479 | }
|
|---|
| 480 | }
|
|---|
| 481 | //�摜�ύX
|
|---|
| 482 | if(aintCount[intIndexX][intIndexY]==0){
|
|---|
| 483 | //����e���Ȃ��ꍇ
|
|---|
| 484 | //���
|
|---|
| 485 | document.getElementById("idImg_"+intIndexX+"_"+intIndexY).src = srcFinish;
|
|---|
| 486 | }else{
|
|---|
| 487 | //����e��������
|
|---|
| 488 | //����e�����
|
|---|
| 489 | document.getElementById("idImg_"+intIndexX+"_"+intIndexY).src = asrcNumber[aintCount[intIndexX][intIndexY]];
|
|---|
| 490 | }
|
|---|
| 491 | }
|
|---|
| 492 | }
|
|---|
| 493 | }
|
|---|
| 494 |
|
|---|
| 495 | //����X�t���O�`�F�b�N
|
|---|
| 496 | if(blnCheckFlg){
|
|---|
| 497 | //����A�b�v
|
|---|
| 498 | intIndex0++;
|
|---|
| 499 | }else{
|
|---|
| 500 | //����ύX����������ꍇ�u���C�N
|
|---|
| 501 | break;
|
|---|
| 502 | }
|
|---|
| 503 | }
|
|---|
| 504 |
|
|---|
| 505 | //�����ۏ��� fncInitCheck();
|
|---|
| 506 |
|
|---|
| 507 | }
|
|---|
| 508 |
|
|---|
| 509 | /***************************************
|
|---|
| 510 | �N���b�N����(ShiftKey����)
|
|---|
| 511 | ***************************************/
|
|---|
| 512 | function fncClickShift(intClickX,intClickY){
|
|---|
| 513 | switch(aintState[intClickX][intClickY]){
|
|---|
| 514 | case STATE_YET:
|
|---|
| 515 | aintState[intClickX][intClickY] = STATE_FLAG;
|
|---|
| 516 | document.getElementById("idImg_"+intClickX+"_"+intClickY).src = srcFlag;
|
|---|
| 517 | break;
|
|---|
| 518 | case STATE_FINISH:
|
|---|
| 519 | break;
|
|---|
| 520 | case STATE_FLAG:
|
|---|
| 521 | aintState[intClickX][intClickY] = STATE_YET;
|
|---|
| 522 | document.getElementById("idImg_"+intClickX+"_"+intClickY).src = srcSpace;
|
|---|
| 523 | break;
|
|---|
| 524 | }
|
|---|
| 525 | }
|
|---|
| 526 |
|
|---|
| 527 | /***************************************
|
|---|
| 528 | �^�C�}�[
|
|---|
| 529 | ***************************************/
|
|---|
| 530 | function fncTimer(){
|
|---|
| 531 | var dtmNow = new Date();
|
|---|
| 532 | var intTime = Math.round((dtmNow.getTime()-dtmTime.getTime())/1000)
|
|---|
| 533 | document.getElementById("idTime").value = intTime;
|
|---|
| 534 | if(intTime>=999){
|
|---|
| 535 | fncMiss("time out",intClickX,intClickY);
|
|---|
| 536 | }
|
|---|
| 537 | }
|
|---|
| 538 | //-->
|
|---|
| 539 | </script>
|
|---|
| 540 | <style>
|
|---|
| 541 | <!--
|
|---|
| 542 | *{
|
|---|
| 543 | color:#000000;
|
|---|
| 544 | font-size:12px;
|
|---|
| 545 | font-weight:bold;
|
|---|
| 546 | font-family:monospace;
|
|---|
| 547 | font-style:normal;
|
|---|
| 548 | text-decoration:none;
|
|---|
| 549 | }
|
|---|
| 550 | table tr form{
|
|---|
| 551 | border:none 0px transparent;
|
|---|
| 552 | }
|
|---|
| 553 | body td{
|
|---|
| 554 | border:none 0px transparent;
|
|---|
| 555 | text-align:center;
|
|---|
| 556 | }
|
|---|
| 557 | hr{
|
|---|
| 558 | border-style:solid;
|
|---|
| 559 | border-color:#999999;
|
|---|
| 560 | height:1px;
|
|---|
| 561 | }
|
|---|
| 562 | .clsBtn{
|
|---|
| 563 | width:25px;
|
|---|
| 564 | height:25px;
|
|---|
| 565 | border-width:0px;
|
|---|
| 566 | border-style:none;
|
|---|
| 567 | border-color:transparent;
|
|---|
| 568 | background-Color:transparent;
|
|---|
| 569 | text-align:center;
|
|---|
| 570 | vertical-align:middle;
|
|---|
| 571 | }
|
|---|
| 572 | .clsParam2Byte{
|
|---|
| 573 | width:20px;
|
|---|
| 574 | ime-mode:disabled;
|
|---|
| 575 | }
|
|---|
| 576 | .clsParam3Byte{
|
|---|
| 577 | width:27px;
|
|---|
| 578 | ime-mode:disabled;
|
|---|
| 579 | }
|
|---|
| 580 | .clsParam8Byte{
|
|---|
| 581 | width:62px;
|
|---|
| 582 | ime-mode:disabled;
|
|---|
| 583 | }
|
|---|
| 584 | img{
|
|---|
| 585 | margin:0px;
|
|---|
| 586 | padding0px;
|
|---|
| 587 | }
|
|---|
| 588 | -->
|
|---|
| 589 | </style>
|
|---|
| 590 | </head>
|
|---|
| 591 | <body onload="fncImage();">
|
|---|
| 592 | <form name="frm" onsubmit="return false;">
|
|---|
| 593 |
|
|---|
| 594 | <table border="0px" cellpadding="0px" cellspacing="0px" >
|
|---|
| 595 | <tr>
|
|---|
| 596 | <td>
|
|---|
| 597 | <table border="0px" cellpadding="0px" cellspacing="0px" >
|
|---|
| 598 | <tr>
|
|---|
| 599 | <td style="width:150px;height:30px;background-Color:#ffcccc;" >open cell:[click]</td>
|
|---|
| 600 | <td style="width:230px;height:30px;background-Color:#ffcccc;" >put flag:[shift key]+[click]</td>
|
|---|
| 601 | </tr>
|
|---|
| 602 | </table>
|
|---|
| 603 | </td>
|
|---|
| 604 | <td>
|
|---|
| 605 | <table border="0px" cellpadding="0px" cellspacing="0px" >
|
|---|
| 606 | <tr>
|
|---|
| 607 | <td style="width:80px;height:30px;background-Color:#ffffcc;" ><button class="clsBtn" style="border-style:outset;" tabindex="-1" onclick="window.focus();return false;" ><img id="idImgBomb" ></button>:bomb</td>
|
|---|
| 608 | <td style="width:80px;height:30px;background-Color:#ffffcc;" ><button class="clsBtn" style="border-style:outset;" tabindex="-1" onclick="window.focus();return false;" ><img id="idImgMiss" ></button>:miss</td>
|
|---|
| 609 | <td style="width:80px;height:30px;background-Color:#ffffcc;" ><button class="clsBtn" style="border-style:outset;" tabindex="-1" onclick="window.focus();return false;" ><img id="idImgFlag" ></button>:flag</td>
|
|---|
| 610 | <td style="width:140px;height:30px;background-Color:#ffffcc;" ><button class="clsBtn" style="border-style:outset;" tabindex="-1" onclick="window.focus();return false;" ><img id="idImgMistake" ></button>:flag(mistake)</td>
|
|---|
| 611 | </tr>
|
|---|
| 612 | </table>
|
|---|
| 613 | </td>
|
|---|
| 614 | </tr>
|
|---|
| 615 | <tr>
|
|---|
| 616 | <td>
|
|---|
| 617 | <table border="0px" cellpadding="0px" cellspacing="0px" >
|
|---|
| 618 | <tr>
|
|---|
| 619 | <td style="width:220px;height:30px;background-Color:#ccffcc;" >
|
|---|
| 620 | level:
|
|---|
| 621 | <input type="radio" name="rdoLevel" id="idLevelL" onclick="fncLevel('L');"><label for="idLevelL">1</label>
|
|---|
| 622 | <input type="radio" name="rdoLevel" id="idLevelM" onclick="fncLevel('M');"><label for="idLevelM">2</label>
|
|---|
| 623 | <input type="radio" name="rdoLevel" id="idLevelH" onclick="fncLevel('H');" checked><label for="idLevelH">3</label>
|
|---|
| 624 | <input type="radio" name="rdoLevel" id="idLevelC" onclick="fncLevel('C');"><label for="idLevelC">custom</label>
|
|---|
| 625 | </td>
|
|---|
| 626 | <td style="width:160px;height:30px;background-Color:#ccffcc;" >
|
|---|
| 627 | <label for="idCellX" >x:</label><input type="text" id="idCellX" class="clsParam2Byte" maxlength="2" value="16" readOnly >
|
|---|
| 628 | <label for="idCellY" >y:</label><input type="text" id="idCellY" class="clsParam2Byte" maxlength="2" value="33" readOnly >
|
|---|
| 629 | <label for="idBomb" >bomb:</label><input type="text" id="idBomb" class="clsParam3Byte" maxlength="3" value="99" readOnly >
|
|---|
| 630 | </td>
|
|---|
| 631 | </tr>
|
|---|
| 632 | </table>
|
|---|
| 633 | </td>
|
|---|
| 634 | <td>
|
|---|
| 635 | <table border="0px" cellpadding="0px" cellspacing="0px" >
|
|---|
| 636 | <tr>
|
|---|
| 637 | <td style="width:110px;height:30px;background-Color:#ccffff;" >
|
|---|
| 638 | <input type="button" value="make stage" onclick="fncDisp();window.focus();" style="width:90px;" >
|
|---|
| 639 | </td>
|
|---|
| 640 | <td style="width:180px;height:30px;background-Color:#ccccff;" >
|
|---|
| 641 | <label for="idCode" >code:</label><input type="text" id="idCode" class="clsParam8Byte" maxlength="8" name="code">
|
|---|
| 642 | <input type="button" value="input" onclick="fncImage();fncDisp();window.focus();" style="width:50px;" >
|
|---|
| 643 | </td>
|
|---|
| 644 | <td style="width:90px;height:30px;background-Color:#ffccff;" >
|
|---|
| 645 | <label for="idTime" >time:</label><input type="text" id="idTime" class="clsParam3Byte" readOnly>
|
|---|
| 646 | </td>
|
|---|
| 647 | </tr>
|
|---|
| 648 | </table>
|
|---|
| 649 | </td>
|
|---|
| 650 | </tr>
|
|---|
| 651 | </table>
|
|---|
| 652 | <div id="idStage" ></div>
|
|---|
| 653 | </form>
|
|---|
| 654 | </body>
|
|---|
| 655 | </html>
|
|---|