當前位置: 首頁>>代碼示例>>PHP>>正文


PHP State::letRest方法代碼示例

本文整理匯總了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;
 }
開發者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::letRest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。