Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
    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));
    }
Esempio n. 4
0
    /**
     * 
     * 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;
    }
Esempio n. 5
0
 public function getPlateau()
 {
     return jeu()->getPlateau();
 }
Esempio n. 6
0
File: Jeu.php Progetto: laiello/ascn
 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;
 }
Esempio n. 7
0
 public function bonneCouleurCase($x, $y)
 {
     return $this->getCouleurCase($x, $y) == jeu()->getRegles()->cases_utilisees;
 }
Esempio n. 8
0
<?php

require_once '../../../config.php';
env()->initJeu('tictactoe');
jeu()->run();
Esempio n. 9
0
 /**
  * 
  * 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;
 }