.
This commit is contained in:
parent
2338d8bd7e
commit
ebb300d6c3
|
@ -38,7 +38,7 @@ switch ($_POST['act']){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$players = $botCount;
|
$_SESSION['players'] = $botCount;
|
||||||
if ($botCount < 2){
|
if ($botCount < 2){
|
||||||
error (500,"missing bots");
|
error (500,"missing bots");
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ switch ($_POST['act']){
|
||||||
'action' => 'init',
|
'action' => 'init',
|
||||||
'game' => 'tron',
|
'game' => 'tron',
|
||||||
'board' => '',
|
'board' => '',
|
||||||
'players' => $players,
|
'players' => $_SESSION['players'],
|
||||||
'player-index' => $botCount
|
'player-index' => $botCount
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -90,13 +90,27 @@ switch ($_POST['act']){
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
$bots = unserialize($_SESSION['bots']);
|
$bots = unserialize($_SESSION['bots']);
|
||||||
|
$board= array();
|
||||||
|
//make the board array
|
||||||
for ($botCount = 0; $botCount < count($bots); $botCount ++){
|
for ($botCount = 0; $botCount < count($bots); $botCount ++){
|
||||||
$sendMessage = array(
|
$board[$botCount] = $bots[$botCount]->getTail();
|
||||||
'game-id' => ''
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
print_r($_SESSION);
|
|
||||||
|
$responses = array();
|
||||||
|
for ($botCount = 0; $botCount < count($bots); $botCount ++){
|
||||||
|
$messageArr = array(
|
||||||
|
'game-id' => '',
|
||||||
|
'action' => 'play-turn',
|
||||||
|
'game' => 'tron',
|
||||||
|
'board' => $board,
|
||||||
|
'player-index' => $botCount, // To do: verifier que ça restera le même à chaque tour
|
||||||
|
'players' => $_SESSION['players']
|
||||||
|
);
|
||||||
|
|
||||||
|
$responses[$botCount] = get_IA_Response($bots[$botCount]->getURL(),$messageArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
print_r($responses);
|
||||||
|
|
||||||
|
|
||||||
die;
|
die;
|
||||||
|
|
|
@ -6,7 +6,9 @@ class TronPlayer{
|
||||||
private $tail = array();
|
private $tail = array();
|
||||||
private $direction;
|
private $direction;
|
||||||
private $state;
|
private $state;
|
||||||
|
public function getTail(){
|
||||||
|
return $this->tail;
|
||||||
|
}
|
||||||
public function getStatus(){
|
public function getStatus(){
|
||||||
return $this->state;
|
return $this->state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user