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


PHP Game::start方法代码示例

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


在下文中一共展示了Game::start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: start

 public function start()
 {
     // 1. The game contains
     $playerA = new Player('Player A');
     $playerB = new Player('Player B');
     $playerC = new Player('Player C');
     $playerD = new Player('Player D');
     // 4 players.
     $playerInstances = [$playerA, $playerB, $playerC, $playerD];
     $game = new Game($playerInstances);
     $game->start();
 }
开发者ID:mario-bros,项目名称:PHPDiceGame,代码行数:12,代码来源:Start.php

示例2: start

 public function start(Player $player1, Player $player2, $loops)
 {
     for ($i = 1; $i <= $loops; $i++) {
         $game = new Game(new Board(), $player1, $player2);
         $winner = $game->start();
         if ($winner instanceof Player) {
             $this->results['wins'][$winner->getName()]++;
         } else {
             $this->results['undecided']++;
         }
     }
     return $this->getWinner();
 }
开发者ID:stijink,项目名称:ticktacktoe-php,代码行数:13,代码来源:StrategyComparer.php

示例3: __autoload

<?php

//magincza fukcja autoloadera
//
function __autoload($file)
{
    include __DIR__ . DIRECTORY_SEPARATOR . $file . '.php';
}
if (!$_GET) {
    ?>

 Rejestracja
        <form action="index.php" method="GET">
            <input type="hidden" name="strona" value="rejestracja">
            <input type="submit"  value="rejestracja"/>
        </form>
        Logowanie
        <form action="index.php" method="GET">
            <input type="hidden" name="strona" value="logowanie">
            <input type="submit"  value="logowanie"/>
        </form>
<?php 
}
$game = new Game();
$game->start();
开发者ID:Andrzej100,项目名称:Projektzaliczenie3,代码行数:25,代码来源:index.php

示例4: Game

<?php

define("GAME", true);
require_once "game/game.php";
$game = new Game();
$game->start(function () use($game) {
    $game->stop();
});
开发者ID:Rudonator,项目名称:Oregon-Trail-PHP,代码行数:8,代码来源:index.php

示例5: htmlentities

    test_token();
    try {
        $player_ids = $Game->invite();
        // send the messages
        $message = 'You have been invited to join the game "' . htmlentities($Game->name, ENT_QUOTES, 'UTF-8', false) . '".' . "\n\n" . 'If you wish to play in this game, please join it from the home page.';
        $message .= "\n\n==== Message ===========================================\n\n" . htmlentities($_POST['extra_text'], ENT_QUOTES, 'UTF-8', false);
        $Message->send_message('Invitation to "' . htmlentities($Game->name, ENT_QUOTES, 'UTF-8', false) . '"', $message, $player_ids, false, ldate('m/d/Y', strtotime('1 week')));
        Flash::store('Game Invitations Sent Successfully');
    } catch (MyException $e) {
        Flash::store('Game Invite FAILED !');
    }
}
if (isset($_POST['start'])) {
    test_token();
    try {
        $Game->start((int) $_POST['player_id']);
        Flash::store('Game Started Successfully', 'game.php?id=' . $_POST['game_id']);
    } catch (MyException $e) {
        Flash::store('Game Start FAILED !', true);
    }
}
// test if we are already in this game or not
$joined = $Game->is_player($_SESSION['player_id']);
$color_selection = '';
foreach ($Game->get_avail_colors() as $color) {
    $color_selection .= '<option class="' . strtolower(substr($color, 0, 3)) . '">' . ucfirst($color) . '</option>';
}
$password_box = '';
if ('' != $Game->passhash) {
    $password_box = '<li><label for="password">Password</label><input type="password" id="password" name="password" /></li>';
}
开发者ID:studywithyou,项目名称:webrisk,代码行数:31,代码来源:join.php


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