本文整理汇总了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();
}
示例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();
}
示例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();
示例4: Game
<?php
define("GAME", true);
require_once "game/game.php";
$game = new Game();
$game->start(function () use($game) {
$game->stop();
});
示例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>';
}