document.all(this.minep[i][0]+"_"+this.minep[i][1]).innertext="*";}
alert("you lose!\nspend time:"+this.timer+"seconds.");
//location.reload();
return;
}
else if(this.board[position[0]][position[1]]<0)
{
this.board[position[0]][position[1]]=-this.board[position[0]][position[1]];
ob.innertext=this.board[position[0]][position[1]];
ob.classname='cl2';
this.blankleft--;
}
if(this.blankleft==this.minenum&&flag)
alert('you win!\nyou spend '+this.timer+' seconds this time.');
}
</script>
<br>
<div align="center" style="color:#ffffff"> 地雷数:
<input type="text" name="textfield1" class="inputclass" value="40">
行数:
<input type="text" name="textfield2" class="inputclass" value="15">
列数:
<input type="text" name="textfield3" class="inputclass" value="15">
<br>
<br>
<input type="submit" name="submit" value="开始游戏" onclick="this.value='再来一次';begin(document.all('textfield1').value,document.all('textfield3').value,document.all('textfield2').value);" style="width:70;height:20;font-size:12px;">
</div>
<script>
var scanbomb;
var t
function begin(bombnum,width,height){
re=/^[1-9]\d*$/gi;
if(!(re.test(bombnum+width+height))){alert("你的输入有误!");return;}
document.all("mark").innertext=0;
document.all('time').innertext=0;
if(t!=null)window.clearinterval(t);
if(bombnum>=width*height)
{alert("地雷的数量不能超过或者等于地图的格数!");return;}
scanbomb=new board(parseint(bombnum),parseint(width),parseint(height));
alert('确定后开始!');
t=window.setinterval("document.all('time').innertext=(++scanbomb.timer);",1000);
}
</script>
<br>
<div align="center" style="color:#ffffff">----------------------power by hill.chiu
丘の工作室----------------------<br>
<a href="mailto:hillhero789@sina.com"><font color="#ffffff">给我意见</font></a><br>
run at ie5.5+</div>
</body>
</html>
//---------------------------------------------------------------
queue.js文件:
// javascript document
function node(value,next)//value为position
{
if(value!=null)
{
this.value=new array(2);
this.value[0]=value[0];
this.value[1]=value[1];}
else
this.value=null;
this.next=next;
}
function queue()
{
this.first=null;//头指针
this.rear=null;//尾指针
this.size=0;//私有
//以下为方法:
this.enter=enter;//进入队列
this.leave=leave;//离开队列
this.isempty=isempty;//判断队列是否为空
this.retrieve=retrieve;//不离开队列,取得数据
}
function isempty()
{
return this.size==0?true:false;
}
function enter(value)
{
if(this.size==0)
this.first=this.rear=new node(value,null);
else
{
this.rear.next=new node(value,null);
this.rear=this.rear.next;
}
this.size++;
}
function leave()
{
if(!this.isempty())
{
var temp=this.first;
this.first=this.first.next;
delete temp;
this.size--;
return true;
}
else
return false;
}
function retrieve()
{
if(!this.isempty())
{
return this.first.value;
}
else
return null;
}