本文整理匯總了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();
}