public function __construct($pion, $case_to, $pion_mange = null, $get_promotion = false) { $this->plateau = jeu()->getPlateau(); $this->pion = $pion; $this->case_to = $case_to; $this->pion_mange = $pion_mange; $this->get_promotion = $get_promotion; }
public static function premierJoueur($with_random = true) { $array = array(); if ($with_random) { $array[] = array('key' => 0, 'value' => 'Aléatoire', 'default' => true); } for ($i = 0; $i < jeu()->nbjoueur_max; $i++) { $array[] = array('key' => $i + 1, 'value' => 'Joueur ' . ($i + 1)); } return new Option('Premier Joueur à jouer', $array); }
public function process() { $slots = queryTab(' select * from slot natural join joueur where partie_id=' . partie()->getID() . ' order by slot_position '); smarty()->assign('slots', $slots); smarty()->assign('options', jeu()->getOptions()); smarty()->assign('isHost', intval(slot()->joueur_id) == intval(partie()->host)); }
/** * * Retourne les slots sur lesquels le joueur * actuelle joue. * Si jeu() n'est pas null, filtre les slots de ce jeu. */ public function getSlots() { if (is_null(jeu())) { $slots = queryTab(' select * from slot where joueur_id=' . joueur()->getID()); } else { $slots = queryTab(' select * from slot natural join partie where joueur_id=' . joueur()->getID() . ' and jeu_id=' . jeu()->getID()); } $ret = array(); foreach ($slots as $slot) { $ret[] = new Slot($slot); } return $ret; }
public function getPlateau() { return jeu()->getPlateau(); }
public final function ajax_lancer_partie() { // Formulaire de lancement de partie recu $r = new AJAXResponse(); try { partie()->lancer(); $r->partie = partie(); $r->slot = partie()->getSlot(joueur()); $r->jeu = jeu(); } catch (Exception $e) { $r->addError($e->getMessage()); } return $r; }
public function bonneCouleurCase($x, $y) { return $this->getCouleurCase($x, $y) == jeu()->getRegles()->cases_utilisees; }
<?php require_once '../../../config.php'; env()->initJeu('tictactoe'); jeu()->run();
/** * * Créer une partie en fonction de l'env. * * @param String $title de la partie * @return Partie qui vient d'etre crée. */ public static function create($title) { Env::requiert('joueur'); Env::requiert('jeu'); $p = new Partie(); $p->jeu_id = jeu()->getID(); $p->host = joueur()->getID(); $p->title = $title; $p->etat = Partie::PREPARATION; $p->save(); return $p; }