protected function addChat($x, $y)
 {
     $chat = new Chat();
     // $chat->getPosition()->setDirection(new Direction(1, 0));
     $chat->getPosition()->setX($x);
     $chat->getPosition()->setY($y);
     return $chat;
 }
Example #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $line = 30;
     //exec('tput lines');
     $colonne = 40;
     //exec('tput cols');
     $symfonyStyle = new SymfonyStyle($input, $output);
     $symfonyStyle->title("IA");
     $mapRender = new ConsoleMapRender($output);
     $chat = new Chat();
     $chat->getPosition()->setDirection(new Direction(1, 0));
     $map = new MapBuilder((new RandomMapProvider($line, $colonne))->getMap());
     $this->render($mapRender, $map, $chat);
 }
Example #3
0
use Map\Render\WebMapRender;
use Map\Player\Chat;
use Map\Location\Direction;
use Map\Provider\RandomMapProvider;
use Map\Builder\MapBuilder;
require __DIR__ . "/../vendor/autoload.php";
session_start();
$line = 30;
//exec('tput lines');
$colonne = 40;
//exec('tput cols');
//$line = exec('tput lines');
//$colonne = exec('tput cols');
$mapRender = new WebMapRender();
if (!isset($_SESSION["chat"])) {
    $chat = new Chat();
    $chat->getPosition()->setDirection(new Direction(1, 0));
} else {
    $chat = unserialize($_SESSION["chat"]);
}
if (!isset($_SESSION["map"])) {
    $map = new MapBuilder((new RandomMapProvider($line, $colonne))->getMap());
} else {
    $map = unserialize($_SESSION["map"]);
}
$chat->move();
$map->setItem($chat->getPosition(), "P");
$mapRender->render($map->getMap());
$_SESSION["chat"] = serialize($chat);
$_SESSION["map"] = serialize($map);