本文整理汇总了PHP中State::letRest方法的典型用法代码示例。如果您正苦于以下问题:PHP State::letRest方法的具体用法?PHP State::letRest怎么用?PHP State::letRest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State::letRest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNewCellStateForDeadCellProvider
/**
* @return array
*/
public function getNewCellStateForDeadCellProvider()
{
$data = [];
// x, y, expected state
$data[] = [0, 2, State::letRest()];
$data[] = [0, 3, State::letRest()];
$data[] = [0, 4, State::letRest()];
$data[] = [1, 4, State::letRest()];
$data[] = [2, 1, State::resurrect("xx")];
$data[] = [2, 3, State::resurrect("yy")];
$data[] = [3, 0, State::letRest()];
$data[] = [3, 1, State::letRest()];
$data[] = [3, 2, State::letRest()];
$data[] = [4, 0, State::letRest()];
$data[] = [4, 1, State::letRest()];
$data[] = [4, 2, State::letRest()];
$data[] = [4, 3, State::letRest()];
$data[] = [4, 4, State::letRest()];
return $data;
}
示例2: getDeadCellNewState
/**
* @param array $neighboursCount
* @return State
*/
private function getDeadCellNewState(array $neighboursCount)
{
foreach ($neighboursCount as $species => $count) {
// If there are exactly three organisms of one type surrounding one element, they may
// give birth into that cell. The new organism is the same type as its parents. If this
// condition is true for more then one species on the same element then species type
// for the new element is chosen randomly.
if ($count == 3) {
return State::resurrect($species);
}
}
return State::letRest();
}