Maison > Article > développement back-end > php开发的简易扫雷游戏_PHP教程
我觉得用PHP+JS可以设计出挺牛逼的二维网页游戏,当然网络型的网页游戏后台数据的交互可以使用java来做数据处理。
= 0 && $j - 1 >= 0 && $data["data".($i - 1)."_".($j - 1)] == 100)$cnt++;//upper left
if($i - 1 >= 0 && $data["data".($i - 1)."_".$j] == 100)$cnt++;//left
if($i - 1 >= 0 && $j + 1 = 0 && $data["data".$i."_".($j - 1)] == 100)$cnt++;//upper
if($j + 1 = 0 && $data["data".($i + 1)."_".($j - 1)] == 100)$cnt++;//upper right
if($i + 1 9?$min:"0".$min).":".($sec>9?$sec:"0".$sec);
}else{
$timeshow = "00:00";//if game is stop , time stop
}
function openNode($i,$j){//set nodes to open,if it is can open
global $rows;//get the rows
global $cols;//get the cols
global $data;//get the data
if($i = $rows || $j = $cols || $data["open".$i."_".$j])return;//it is not a node,or it has been opened
$data["open".$i."_".$j] = 1;//open the node
if($data["data".$i."_".$j] > 0)return;//need to continue?
openNode($i - 1,$j - 1);
openNode($i - 1,$j);
openNode($i - 1,$j + 1);
openNode($i,$j - 1);
openNode($i,$j + 1);
openNode($i + 1,$j - 1);
openNode($i + 1,$j);
openNode($i + 1,$j + 1);
}
?>