php实现的简易扫雷游戏实例_php技巧
程序员文章站
2022-05-27 09:42:21
...
本文实例讲述了php实现的简易扫雷游戏。分享给大家供大家参考。具体如下:
= 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); } ?>扫雷游戏
希望本文所述对大家的php程序设计有所帮助。