当前位置: 首页>>代码示例>>PHP>>正文


PHP State::resurrect方法代码示例

本文整理汇总了PHP中State::resurrect方法的典型用法代码示例。如果您正苦于以下问题:PHP State::resurrect方法的具体用法?PHP State::resurrect怎么用?PHP State::resurrect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在State的用法示例。


在下文中一共展示了State::resurrect方法的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;
 }
开发者ID:jelito,项目名称:game-of-life-glogster,代码行数:23,代码来源:CellManagerTest.php

示例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();
 }
开发者ID:jelito,项目名称:game-of-life-glogster,代码行数:17,代码来源:CellManager.php


注:本文中的State::resurrect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。