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");
$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());
<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;
* 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();
$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();
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();