文件名称:landmine
介绍说明--下载内容均来自于网络,请自行研究使用
踩地雷_950513簡易版
public void set_mine(){
Random ran= new Random()
int tmp=0,x=0,y=0
for(int i=0 i<m_num i++){
do{
tmp=ran.Next(0,w_num*w_num)
}while( flag[tmp % w_num, tmp / w_num] == 9)
flag[tmp % w_num, tmp / w_num] = 9
}
for(int k=0 k< w_num*w_num k++){
x=k % w_num
y=k / w_num
if(flag[x, y] == 9){
int x_min=(x>0)?x-1:x
int x_max=(k % w_num == w_num-1)?k % w_num + 1:k % w_num + 2
int y_min=(y>0)?y-1:y
int y_max=(k / w_num == w_num-1)?k / w_num + 1:k / w_num + 2
for(int i=x_min i< x_max i++){
for(int j=y_min j< y_max j++){
if(flag[i,j] != 9)
flag[i,j]=flag[i,j] + 1
}
}
}
}
}
public void set_mine(){
Random ran= new Random()
int tmp=0,x=0,y=0
for(int i=0 i<m_num i++){
do{
tmp=ran.Next(0,w_num*w_num)
}while( flag[tmp % w_num, tmp / w_num] == 9)
flag[tmp % w_num, tmp / w_num] = 9
}
for(int k=0 k< w_num*w_num k++){
x=k % w_num
y=k / w_num
if(flag[x, y] == 9){
int x_min=(x>0)?x-1:x
int x_max=(k % w_num == w_num-1)?k % w_num + 1:k % w_num + 2
int y_min=(y>0)?y-1:y
int y_max=(k / w_num == w_num-1)?k / w_num + 1:k / w_num + 2
for(int i=x_min i< x_max i++){
for(int j=y_min j< y_max j++){
if(flag[i,j] != 9)
flag[i,j]=flag[i,j] + 1
}
}
}
}
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : 89346517landmine.rar 列表 津