本文整理汇总了PHP中Game::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::run方法的具体用法?PHP Game::run怎么用?PHP Game::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game::run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gaichu
echo 'コスパ' . $cospa . ' 稼働可能社員' . $rest_worker . "人\n";
if ($cospa < 0.5 || $worker_count >= 5) {
echo 'この仕事は外注しました' . "\n";
$this->gaichu($result['id'], intval($result['reward'] * 0.7));
} else {
$this->assign('assign', $result['id'], $assign_text);
}
return true;
} else {
echo 'この仕事は間に合いません.外注します' . $result['id'];
$this->gaichu($result['id'], intval($result['reward'] * 0.7));
return false;
}
}
public function gaichu($task_id, $reward)
{
$url = ENDPOINT . 'outsource?task=' . $task_id . '&orderReward=' . $reward . '&token=' . TOKEN;
$result = file_get_contents($url);
var_dump($result);
}
public function assign($resources = 'assign', $task_id, $worker)
{
$url = ENDPOINT . $resources . '?task=' . $task_id . '&worker=' . $worker . '&token=' . TOKEN;
$result = file_get_contents($url);
var_dump($result);
return $result;
}
}
$game_obj = new Game();
$game_obj->run();
console("test");
示例2: array
$focus .= '</script>';
$smarty->assign("focus", $focus);
/* Set channel if needed */
//TODO: * move all global session calls to global_
// * create a new channel where needed (mostly management dialogues)
// * remove regulary created channels when not needed anymore
// * take a look at external php calls (i.e. get fax, ldif, etc.)
// * handle aborted sessions (by pressing anachors i.e. Main, Menu, etc.)
// * check lock removals, is "dn" global or not in this case?
// * last page request -> global or not?
// * check that filters are still global
// * maxC global?
if (isset($_POST['_channel_'])) {
echo "DEBUG - current channel: " . $_POST['_channel_'];
$smarty->assign("channel", $_POST['_channel_']);
} else {
$smarty->assign("channel", "");
}
$smarty->assign("title", "FusionDirectory");
if (class_available('Game')) {
$smarty->assign('game_screen', Game::run());
} else {
$smarty->assign('game_screen', '');
}
$display = $smarty->fetch(get_template_path('headers.tpl')) . $smarty->fetch(get_template_path('framework.tpl'));
/* Show page... */
echo $display;
/* Save plist and config */
session::global_set('plist', $plist);
session::global_set('config', $config);
session::set('errorsAlreadyPosted', array());
示例3: isset
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/styles.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="page-header text-center">
<h1 class="visible-lg">COMP 4711 - Lab 1</h1>
<h2 class="visible-md visible-sm visible-xs">COMP 4711 - Lab 1</h2>
</div>
<div class="text-center">
<?php
$board = isset($_GET["board"]) ? $_GET["board"] : null;
$game = new Game($board);
$game->run();
?>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
<?php
class Game
{
var $position;
示例4: run
* reads input datas (zone ownerid and the coordinates of drones of all teams)
*/
public function run()
{
while (1) {
foreach ($this->zones as $zone) {
$zone->ownerId = (int) trim(fgets(STDIN));
}
foreach ($this->teams as $team) {
foreach ($team->drones as $drone) {
list($drone->pos->x, $drone->pos->y) = explode(' ', trim(fgets(STDIN)), 2);
}
}
$this->play();
}
}
/**
* Your logic goes here
*/
public function play()
{
$myDrones = $this->teams[$this->myTeamId]->drones;
foreach ($myDrones as $droneId => $drone) {
print "3999 1799\n";
}
}
}
$g = new Game();
$g->init();
$g->run();
示例5: run
$this->assign($job, $this->machines[$key]);
}
}
}
function next_turn()
{
return $this->requestAPI($this->host . '/games/' . $this->current_game->id . '/next_turn');
}
function run()
{
$turn = $this->next_turn();
$this->status = $turn->status;
$this->total_jobs_found += count($turn->jobs);
echo "\nOn turn " . $turn->current_turn . ", got " . count($turn->jobs) . " jobs, having completed " . $turn->jobs_completed . " of " . $this->total_jobs_found . " with " . $turn->jobs_running . " jobs running, " . $turn->jobs_queued . " jobs queued, and " . $turn->machines_running . " machines running";
if ($this->status != 'completed') {
$this->clean_machines();
if (count($turn->jobs)) {
$this->assign_jobs($turn->jobs);
}
$this->run();
} else {
$completed_game = $this->requestAPI($this->host . '/games/' . $this->current_game->id);
echo "\n\nCOMPLETED GAME WITH:";
echo "\nTotal delay: " . $completed_game->delay_turns . " turns";
echo "\nTotal cost: \$" . $completed_game->cost . "\n";
}
}
}
$objGame = new Game(array("long" => false));
$objGame->run();
示例6: movePecaImprimeTabuleiro
include_once "Tabuleiro.php";
include_once "TipoComputador.php";
include_once "Util.php";
include_once "Game.php";
function movePecaImprimeTabuleiro($tabuleiro, $px, $py, $ax, $ay)
{
echo "-------------------------------\n";
echo "{$tabuleiro}\n";
echo "-------------------------------\n";
}
$tabuleiro = Tabuleiro::getInstance();
echo "----- INICIAL -----" . "\n";
echo $tabuleiro;
//echo $tabuleiro[6][3]->getPeca();
$pc = new Game();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();
$pc->run();