本文整理汇总了PHP中test::simulate方法的典型用法代码示例。如果您正苦于以下问题:PHP test::simulate方法的具体用法?PHP test::simulate怎么用?PHP test::simulate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test
的用法示例。
在下文中一共展示了test::simulate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateWithParams
public function generateWithParams()
{
//the posted value from dimensions is inserted into the session variable
$_SESSION["dimension"] = $_POST["dimension"];
$_SESSION["startNrPlants"] = $_POST["startNrPlants"];
$_SESSION["startNrCarnivores"] = $_POST["startNrCarnivore"];
$_SESSION["startNrHerbivores"] = $_POST["startNrHerbivore"];
//If the amount of plants+Carnivores+Herbivores is higher than the amount of squares in the matrix
//then there is a message for the matrix being too full.
if ($_SESSION["startNrPlants"] + $_SESSION["startNrCarnivores"] + $_SESSION["startNrHerbivores"] >= pow($_SESSION["dimension"], 2)) {
include 'Presentation/home.php';
} else {
$matrix = new test();
$_SESSION['days'] = $matrix->simulate();
$days = $_SESSION['days'];
$_SESSION['daynumber'] = 0;
$daynumber = $_SESSION['daynumber'];
$day = $days[$daynumber];
include 'Presentation/home.php';
//header("location: ../Presentation/home.php");
}
}